Chromium Code Reviews| Index: pkg/unittest/test/matchers_test.dart |
| =================================================================== |
| --- pkg/unittest/test/matchers_test.dart (revision 21707) |
| +++ pkg/unittest/test/matchers_test.dart (working copy) |
| @@ -237,21 +237,26 @@ |
| shouldPass(b, hasLength(2)); |
| }); |
| - test('type mismatch', () { |
| - var a = new DateTime.utc(2000); |
| - var b = a.toString(); |
| - // We should get something like: |
| - // Expected: '2000-01-01 00:00:00.000Z' |
| - // but: expected String:'2000-01-01 00:00:00.000Z' |
| - // but was DateTime:<2000-01-01 00:00:00.000Z>. |
| - // However, if minification is applied, then the type names |
| - // will be shortened to two letters. The key thing is that |
| - // there will be a "but: expected" part in the middle; |
| - // this only happens with type mismatches or mismatches |
| - // inside container types. |
| - shouldFail(a, equals(b), |
| - matches(new RegExp("^Expected.*but: expected .*but was.*\$"))); |
| + test('scalar type mismatch', () { |
| + shouldFail('error', equals(5.0), |
| + matches("^Expected: <5\.0>" |
| + " but: was .*:'error' \\(not type .*\\)\.\$")); |
|
Siggi Cherem (dart-lang)
2013/04/19 17:18:24
now that is shorter, can we spell it out here?
"
|
| }); |
| + |
| + test('nested type mismatch', () { |
| + shouldFail(['error'], equals([5.0]), |
| + matches(r"^Expected: <\[5\.0\]>" |
| + " but: expected double:<5\.0> " |
| + "but was .*:'error' mismatch at position 0\.\$")); |
| + }); |
| + |
| + test('doubly-nested type mismatch', () { |
| + shouldFail([['error']], equals([[5.0]]), |
| + matches(r"^Expected: <\[\[5\.0\]\]>" |
| + " but: expected double:<5\.0> " |
| + "but was .*:'error' mismatch at position 0 " |
| + "mismatch at position 0\.\$")); |
| + }); |
| }); |
| group('Numeric Matchers', () { |
| @@ -502,7 +507,7 @@ |
| shouldPass(d, orderedEquals([1, 2])); |
| shouldFail(d, orderedEquals([2, 1]), |
| "Expected: equals <[2, 1]> ordered " |
| - "but: was <1> mismatch at position 0."); |
| + "but: expected <2> but was <1> mismatch at position 0."); |
| }); |
| test('unorderedEquals', () { |