Index: lib/src/iterable_matchers.dart |
diff --git a/lib/src/iterable_matchers.dart b/lib/src/iterable_matchers.dart |
index 60ef32d09b2abdbc0c9504c3c864b020d0475062..118575a5b4fbf9de8c6dcbe774569cbcb512e96c 100644 |
--- a/lib/src/iterable_matchers.dart |
+++ b/lib/src/iterable_matchers.dart |
@@ -36,16 +36,18 @@ class _EveryElement extends _IterableMatcher { |
Description describe(Description description) => |
description.add('every element(').addDescriptionOf(_matcher).add(')'); |
- Description describeMismatch(item, Description mismatchDescription, |
- Map matchState, bool verbose) { |
+ Description describeMismatch( |
+ item, Description mismatchDescription, Map matchState, bool verbose) { |
if (matchState['index'] != null) { |
var index = matchState['index']; |
var element = matchState['element']; |
- mismatchDescription.add('has value ').addDescriptionOf(element). |
- add(' which '); |
+ mismatchDescription |
+ .add('has value ') |
+ .addDescriptionOf(element) |
+ .add(' which '); |
var subDescription = new StringDescription(); |
- _matcher.describeMismatch(element, subDescription, matchState['state'], |
- verbose); |
+ _matcher.describeMismatch( |
+ element, subDescription, matchState['state'], verbose); |
if (subDescription.length > 0) { |
mismatchDescription.add(subDescription.toString()); |
} else { |
@@ -55,8 +57,8 @@ class _EveryElement extends _IterableMatcher { |
mismatchDescription.add(' at index $index'); |
return mismatchDescription; |
} |
- return super.describeMismatch(item, mismatchDescription, |
- matchState, verbose); |
+ return super.describeMismatch( |
+ item, mismatchDescription, matchState, verbose); |
} |
} |
@@ -97,13 +99,13 @@ class _OrderedEquals extends Matcher { |
Description describe(Description description) => |
description.add('equals ').addDescriptionOf(_expected).add(' ordered'); |
- Description describeMismatch(item, Description mismatchDescription, |
- Map matchState, bool verbose) { |
- if (item is !Iterable) { |
+ Description describeMismatch( |
+ item, Description mismatchDescription, Map matchState, bool verbose) { |
+ if (item is! Iterable) { |
return mismatchDescription.add('is not an Iterable'); |
} else { |
- return _matcher.describeMismatch(item, mismatchDescription, |
- matchState, verbose); |
+ return _matcher.describeMismatch( |
+ item, mismatchDescription, matchState, verbose); |
} |
} |
} |
@@ -121,26 +123,23 @@ class _UnorderedEquals extends _UnorderedMatches { |
: super(expected.map(equals)), |
_expectedValues = expected.toList(); |
- Description describe(Description description) => |
- description |
- .add('equals ') |
- .addDescriptionOf(_expectedValues) |
- .add(' unordered'); |
+ Description describe(Description description) => description |
+ .add('equals ') |
+ .addDescriptionOf(_expectedValues) |
+ .add(' unordered'); |
} |
/// Iterable matchers match against [Iterable]s. We add this intermediate |
/// class to give better mismatch error messages than the base Matcher class. |
abstract class _IterableMatcher extends Matcher { |
const _IterableMatcher(); |
- Description describeMismatch(item, Description mismatchDescription, |
- Map matchState, bool verbose) { |
+ Description describeMismatch( |
+ item, Description mismatchDescription, Map matchState, bool verbose) { |
if (item is! Iterable) { |
- return mismatchDescription. |
- addDescriptionOf(item). |
- add(' not an Iterable'); |
+ return mismatchDescription.addDescriptionOf(item).add(' not an Iterable'); |
} else { |
- return super.describeMismatch(item, mismatchDescription, matchState, |
- verbose); |
+ return super.describeMismatch( |
+ item, mismatchDescription, matchState, verbose); |
} |
} |
} |
@@ -198,14 +197,13 @@ class _UnorderedMatches extends Matcher { |
bool matches(item, Map mismatchState) => _test(item) == null; |
- Description describe(Description description) => |
- description |
+ Description describe(Description description) => description |
.add('matches ') |
.addAll('[', ', ', ']', _expected) |
.add(' unordered'); |
- Description describeMismatch(item, Description mismatchDescription, |
- Map matchState, bool verbose) => |
+ Description describeMismatch( |
+ item, Description mismatchDescription, Map matchState, bool verbose) => |
mismatchDescription.add(_test(item)); |
} |
@@ -214,8 +212,8 @@ class _UnorderedMatches extends Matcher { |
/// The [comparator] function, taking an expected and an actual argument, and |
/// returning whether they match, will be applied to each pair in order. |
/// [description] should be a meaningful name for the comparator. |
-Matcher pairwiseCompare(Iterable expected, bool comparator(a, b), |
- String description) => |
+Matcher pairwiseCompare( |
+ Iterable expected, bool comparator(a, b), String description) => |
new _PairwiseCompare(expected, comparator, description); |
typedef bool _Comparator(a, b); |
@@ -235,8 +233,11 @@ class _PairwiseCompare extends _IterableMatcher { |
for (var e in _expected) { |
iterator.moveNext(); |
if (!_comparator(e, iterator.current)) { |
- addStateInfo(matchState, {'index': i, 'expected': e, |
- 'actual': iterator.current}); |
+ addStateInfo(matchState, { |
+ 'index': i, |
+ 'expected': e, |
+ 'actual': iterator.current |
+ }); |
return false; |
} |
i++; |
@@ -247,20 +248,20 @@ class _PairwiseCompare extends _IterableMatcher { |
Description describe(Description description) => |
description.add('pairwise $_description ').addDescriptionOf(_expected); |
- Description describeMismatch(item, Description mismatchDescription, |
- Map matchState, bool verbose) { |
- if (item is !Iterable) { |
+ Description describeMismatch( |
+ item, Description mismatchDescription, Map matchState, bool verbose) { |
+ if (item is! Iterable) { |
return mismatchDescription.add('is not an Iterable'); |
} else if (item.length != _expected.length) { |
- return mismatchDescription. |
- add('has length ${item.length} instead of ${_expected.length}'); |
+ return mismatchDescription |
+ .add('has length ${item.length} instead of ${_expected.length}'); |
} else { |
- return mismatchDescription. |
- add('has '). |
- addDescriptionOf(matchState["actual"]). |
- add(' which is not $_description '). |
- addDescriptionOf(matchState["expected"]). |
- add(' at index ${matchState["index"]}'); |
+ return mismatchDescription |
+ .add('has ') |
+ .addDescriptionOf(matchState["actual"]) |
+ .add(' which is not $_description ') |
+ .addDescriptionOf(matchState["expected"]) |
+ .add(' at index ${matchState["index"]}'); |
} |
} |
} |