Chromium Code Reviews| Index: test/core_matchers_test.dart |
| diff --git a/test/core_matchers_test.dart b/test/core_matchers_test.dart |
| index 702489404ad8d11bdeb13cca7b3b7f421bed3e97..a9f7ca05d434b92b019444948b6d203425abb77b 100644 |
| --- a/test/core_matchers_test.dart |
| +++ b/test/core_matchers_test.dart |
| @@ -10,8 +10,6 @@ import 'package:unittest/unittest.dart' show test, group; |
| import 'test_utils.dart'; |
| void main() { |
| - initUtils(); |
| - |
| test('isTrue', () { |
| shouldPass(true, isTrue); |
| shouldFail(false, isTrue, "Expected: true Actual: <false>"); |
| @@ -117,7 +115,7 @@ void main() { |
| shouldPass(a, hasLength(0)); |
| shouldPass(b, hasLength(0)); |
| shouldPass('a', hasLength(1)); |
| - shouldFail(0, hasLength(0), new PrefixMatcher( |
| + shouldFail(0, hasLength(0), new _PrefixMatcher( |
| "Expected: an object with length of <0> " |
| "Actual: <0> " |
| "Which: has no length property")); |
| @@ -190,3 +188,17 @@ void main() { |
| }); |
| }); |
| } |
| + |
| +class _PrefixMatcher extends Matcher { |
|
nweiz
2015/02/17 23:17:42
Add at least a short description of this.
kevmoo
2015/02/18 00:33:40
Or remove it. Much easier. :-)
|
| + final String _prefix; |
| + const _PrefixMatcher(this._prefix); |
| + bool matches(item, Map matchState) { |
| + return item is String && |
| + (collapseWhitespace(item)).startsWith(collapseWhitespace(_prefix)); |
| + } |
| + |
| + Description describe(Description description) => description |
| + .add('a string starting with ') |
| + .addDescriptionOf(collapseWhitespace(_prefix)) |
| + .add(' ignoring whitespace'); |
| +} |