Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: matchers specifically for streams #134

Closed
kevmoo opened this issue Jun 5, 2015 · 13 comments
Closed

Request: matchers specifically for streams #134

kevmoo opened this issue Jun 5, 2015 · 13 comments
Labels
closed-duplicate Closed in favor of an existing report type-enhancement A request for a change that isn't a bug

Comments

@kevmoo
Copy link
Member

kevmoo commented Jun 5, 2015

From @DartBot on March 4, 2013 4:40

This issue was originally filed by @sethladd


I'd love to see some matchers specifically for testing streams. The matchers package has a few matchers for handling Future (like completes).

Copied from original issue: dart-lang/sdk#8899

@kevmoo
Copy link
Member Author

kevmoo commented Jun 5, 2015

From @DartBot on March 4, 2013 4:40

This comment was originally written by @sethladd


File under Area=UnitTest

@kevmoo
Copy link
Member Author

kevmoo commented Jun 5, 2015

From @lrhn on March 4, 2013 13:33

Removed Type-Defect label.
Added Type-Enhancement, Area-UnitTest, Triaged labels.

@kevmoo
Copy link
Member Author

kevmoo commented Jun 5, 2015

From @DartBot on March 4, 2013 17:34

This comment was originally written by @seaneagan


For starters could make most Iterable Matchers also work for Streams, since the API is so similar:

isEmpty
hasLength
contains
isIn
orderedEquals
unorderedEquals
someElement (rename to anyElement, since Iterable.some is now Iterable.any)
everyElement

@kevmoo
Copy link
Member Author

kevmoo commented Jun 5, 2015

From @DartBot on March 4, 2013 19:35

This comment was originally written by @seaneagan


I think to help with implementing these sorts of Matchers, it would probably be useful if Matcher.matches were allowed to return a Future<bool> instead of just a bool.

@kevmoo
Copy link
Member Author

kevmoo commented Jun 5, 2015

From @DartBot on March 4, 2013 21:5

This comment was originally written by @seaneagan


And actually it would probably work better as a rich MatchResult object instead of a plain bool, so it can store data about why it didn't match, to be used in "describe":

class Matcher {
  /// returns either [MatchResult] or [Future<MatchResult>] representing the match result
  match(object);
}

class MatchResult {
  final bool isMatch;
  Description describe(Description description, {bool verbose = false});
}
class Match extends MatchResult {...}
class Mismatch extends MatchResult {...}

@kevmoo
Copy link
Member Author

kevmoo commented Jun 5, 2015

From @gramster on April 24, 2013 20:21

Regarding the mismatch state, we already have a mechanism for that (MatchState).

@kevmoo
Copy link
Member Author

kevmoo commented Jun 5, 2015

From @DartBot on April 24, 2013 21:10

This comment was originally written by @seaneagan


returning Future<bool> from Matcher.matches is filed as issue #10188

@kevmoo
Copy link
Member Author

kevmoo commented Jun 5, 2015

Added Pkg-Unittest label.

@kevmoo
Copy link
Member Author

kevmoo commented Jun 5, 2015

Removed Area-UnitTest label.
Added Area-Pkg label.

@kevmoo
Copy link
Member Author

kevmoo commented Jun 5, 2015

Removed Pkg-Unittest label.
Added Pkg-matcher label.

@kevmoo
Copy link
Member Author

kevmoo commented Jun 5, 2015

From @sethladd on June 4, 2015 22:52

cc @kevmoo @nex3

Please close if this isn't planned.

@kevmoo
Copy link
Member Author

kevmoo commented Jun 5, 2015

From @nex3 on June 4, 2015 23:41

This is still planned, although it'll be in test rather than matcher.

@nex3
Copy link
Member

nex3 commented Jul 14, 2015

Duplicate of #25.

@nex3 nex3 closed this as completed Jul 14, 2015
@nex3 nex3 added the closed-duplicate Closed in favor of an existing report label Jul 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-duplicate Closed in favor of an existing report type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

2 participants