Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Unified Diff: pkg/scheduled_test/lib/src/stream_matcher.dart

Issue 171473002: Rename "description" to "failure" in the scheduled_test stream matchers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/scheduled_test/lib/src/stream_matcher.dart
diff --git a/pkg/scheduled_test/lib/src/stream_matcher.dart b/pkg/scheduled_test/lib/src/stream_matcher.dart
index f92a1c425b9be9b25072ee7548b0173eac795054..232e73f2ba580ad58aafa76fee7185765950ee7a 100644
--- a/pkg/scheduled_test/lib/src/stream_matcher.dart
+++ b/pkg/scheduled_test/lib/src/stream_matcher.dart
@@ -140,8 +140,8 @@ class _NextValuesMatcher implements StreamMatcher {
});
}
- return collectValues(_n).then((description) {
- if (description != null) return description;
+ return collectValues(_n).then((failure) {
+ if (failure != null) return failure;
var matchState = {};
if (_matcher.matches(collectedValues, matchState)) return null;
return _matcher.describeMismatch(collectedValues, new StringDescription(),
@@ -170,12 +170,12 @@ class _InOrderMatcher implements StreamMatcher {
matchNext() {
if (matchers.isEmpty) return new Future.value();
var matcher = matchers.removeFirst();
- return matcher.tryMatch(stream).then((description) {
- if (description == null) return matchNext();
- var newDescription = new StringDescription(
+ return matcher.tryMatch(stream).then((failure) {
+ if (failure == null) return matchNext();
+ var newFailure = new StringDescription(
'matcher #${_matchers.length - matchers.length} failed');
- if (description.length != 0) newDescription.add(':\n$description');
- return newDescription;
+ if (failure.length != 0) newFailure.add(':\n$failure');
+ return newFailure;
});
}
@@ -231,26 +231,26 @@ class _EitherMatcher implements StreamMatcher {
return Future.wait([
_matcher1.tryMatch(stream1).whenComplete(stream1.close),
_matcher2.tryMatch(stream2).whenComplete(stream2.close)
- ]).then((descriptions) {
- var description1 = descriptions.first;
- var description2 = descriptions.last;
+ ]).then((failures) {
+ var failure1 = failures.first;
+ var failure2 = failures.last;
// If both matchers matched, use the one that consumed more of the stream.
- if (description1 == null && description2 == null) {
+ if (failure1 == null && failure2 == null) {
if (stream1.emittedValues.length >= stream2.emittedValues.length) {
return _matcher1.tryMatch(stream);
} else {
return _matcher2.tryMatch(stream);
}
- } else if (description1 == null) {
+ } else if (failure1 == null) {
return _matcher1.tryMatch(stream);
- } else if (description2 == null) {
+ } else if (failure2 == null) {
return _matcher2.tryMatch(stream);
} else {
return new StringDescription('both\n')
- .add(prefixLines(description1.toString(), prefix: ' '))
+ .add(prefixLines(failure1.toString(), prefix: ' '))
.add('\nand\n')
- .add(prefixLines(description2.toString(), prefix: ' '))
+ .add(prefixLines(failure2.toString(), prefix: ' '))
.toString();
}
});
@@ -274,8 +274,8 @@ class _AllowMatcher implements StreamMatcher {
Future<Description> tryMatch(ScheduledStream stream) {
var fork = stream.fork();
- return _matcher.tryMatch(fork).whenComplete(fork.close).then((description) {
- if (description != null) return null;
+ return _matcher.tryMatch(fork).whenComplete(fork.close).then((failure) {
+ if (failure != null) return null;
return _matcher.tryMatch(stream);
});
}
@@ -301,8 +301,8 @@ class _NeverMatcher implements StreamMatcher {
var fork = stream.fork();
return _matcher.tryMatch(fork).whenComplete(fork.close)
- .then((description) {
- if (description != null) {
+ .then((failure) {
+ if (failure != null) {
return stream.next().then((_) => consumeNext());
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698