| Index: lib/unittest/string_matchers.dart
|
| ===================================================================
|
| --- lib/unittest/string_matchers.dart (revision 10002)
|
| +++ lib/unittest/string_matchers.dart (working copy)
|
| @@ -16,7 +16,8 @@
|
| _matchValue = _value.toLowerCase();
|
| }
|
|
|
| - bool matches(item) => item is String && _matchValue == item.toLowerCase();
|
| + bool matches(item, MatchState mismatchState) =>
|
| + item is String && _matchValue == item.toLowerCase();
|
|
|
| Description describe(Description description) =>
|
| description.addDescriptionOf(_value).add(' ignoring case');
|
| @@ -41,18 +42,20 @@
|
| _matchValue = collapseWhitespace(_value);
|
| }
|
|
|
| - bool matches(item) =>
|
| + bool matches(item, MatchState matchState) =>
|
| item is String && _matchValue == collapseWhitespace(item);
|
|
|
| Description describe(Description description) =>
|
| description.addDescriptionOf(_matchValue).add(' ignoring whitespace');
|
|
|
| - Description describeMismatch(item, Description mismatchDescription) {
|
| + Description describeMismatch(item, Description mismatchDescription,
|
| + MatchState matchState, bool verbose) {
|
| if (item is String) {
|
| return mismatchDescription.add('was ').
|
| addDescriptionOf(collapseWhitespace(item));
|
| } else {
|
| - return super.describeMismatch(item, mismatchDescription);
|
| + return super.describeMismatch(item, mismatchDescription,
|
| + matchState, verbose);
|
| }
|
| }
|
| }
|
| @@ -91,7 +94,8 @@
|
|
|
| const _StringStartsWith(this._prefix);
|
|
|
| - bool matches(item) => item is String && item.startsWith(_prefix);
|
| + bool matches(item, MatchState matchState) =>
|
| + item is String && item.startsWith(_prefix);
|
|
|
| Description describe(Description description) =>
|
| description.add('a string starting with ').addDescriptionOf(_prefix);
|
| @@ -109,7 +113,8 @@
|
|
|
| const _StringEndsWith(this._suffix);
|
|
|
| - bool matches(item) => item is String && item.endsWith(_suffix);
|
| + bool matches(item, MatchState matchState) =>
|
| + item is String && item.endsWith(_suffix);
|
|
|
| Description describe(Description description) =>
|
| description.add('a string ending with ').addDescriptionOf(_suffix);
|
| @@ -131,7 +136,7 @@
|
|
|
| const _StringContainsInOrder(this._substrings);
|
|
|
| - bool matches(item) {
|
| + bool matches(item, MatchState matchState) {
|
| if (!(item is String)) {
|
| return false;
|
| }
|
| @@ -170,7 +175,8 @@
|
| }
|
| }
|
|
|
| - bool matches(String item) => _regexp.hasMatch(item);
|
| + bool matches(String item, MatchState matchState) =>
|
| + _regexp.hasMatch(item);
|
|
|
| Description describe(Description description) =>
|
| description.add("match '${_regexp.pattern}'");
|
| @@ -180,13 +186,15 @@
|
| // class to give better mismatch error messages than the base Matcher class.
|
| /* abstract */ class _StringMatcher extends BaseMatcher {
|
| const _StringMatcher();
|
| - Description describeMismatch(item, Description mismatchDescription) {
|
| + Description describeMismatch(item, Description mismatchDescription,
|
| + MatchState matchState, bool verbose) {
|
| if (!(item is String)) {
|
| return mismatchDescription.
|
| addDescriptionOf(item).
|
| add(' not a string');
|
| } else {
|
| - return super.describeMismatch(item, mismatchDescription);
|
| + return super.describeMismatch(item, mismatchDescription,
|
| + matchState, verbose);
|
| }
|
| }
|
| }
|
|
|