| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 | 7 |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 | 9 |
| 10 import 'test_common.dart'; | 10 import 'test_common.dart'; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 shouldPass(0, anything); | 58 shouldPass(0, anything); |
| 59 shouldPass(null, anything); | 59 shouldPass(null, anything); |
| 60 shouldPass(a, anything); | 60 shouldPass(a, anything); |
| 61 shouldFail(a, isNot(anything), "Expected: not anything Actual: {}"); | 61 shouldFail(a, isNot(anything), "Expected: not anything Actual: {}"); |
| 62 }); | 62 }); |
| 63 | 63 |
| 64 test('throws', () { | 64 test('throws', () { |
| 65 shouldFail(doesNotThrow, throws, | 65 shouldFail(doesNotThrow, throws, |
| 66 matches( | 66 matches( |
| 67 r"Expected: throws" | 67 r"Expected: throws" |
| 68 r" Actual: <Closure(: \(dynamic\) => dynamic " | 68 r" Actual: <Closure(: \(\) => dynamic " |
| 69 r"from Function 'doesNotThrow': static\.)?>" | 69 r"from Function 'doesNotThrow': static\.)?>" |
| 70 r" Which: did not throw")); | 70 r" Which: did not throw")); |
| 71 shouldPass(doesThrow, throws); | 71 shouldPass(doesThrow, throws); |
| 72 shouldFail(true, throws, | 72 shouldFail(true, throws, |
| 73 "Expected: throws" | 73 "Expected: throws" |
| 74 " Actual: <true>" | 74 " Actual: <true>" |
| 75 " Which: is not a Function or Future"); | 75 " Which: is not a Function or Future"); |
| 76 }); | 76 }); |
| 77 | 77 |
| 78 test('throwsA', () { | 78 test('throwsA', () { |
| 79 shouldPass(doesThrow, throwsA(equals('X'))); | 79 shouldPass(doesThrow, throwsA(equals('X'))); |
| 80 shouldFail(doesThrow, throwsA(equals('Y')), | 80 shouldFail(doesThrow, throwsA(equals('Y')), |
| 81 matches( | 81 matches( |
| 82 r"Expected: throws 'Y'" | 82 r"Expected: throws 'Y'" |
| 83 r" Actual: <Closure(: \(dynamic\) => dynamic " | 83 r" Actual: <Closure(: \(\) => dynamic " |
| 84 r"from Function 'doesThrow': static\.)?>" | 84 r"from Function 'doesThrow': static\.)?>" |
| 85 r" Which: threw 'X'")); | 85 r" Which: threw 'X'")); |
| 86 }); | 86 }); |
| 87 | 87 |
| 88 test('returnsNormally', () { | 88 test('returnsNormally', () { |
| 89 shouldPass(doesNotThrow, returnsNormally); | 89 shouldPass(doesNotThrow, returnsNormally); |
| 90 shouldFail(doesThrow, returnsNormally, | 90 shouldFail(doesThrow, returnsNormally, |
| 91 matches( | 91 matches( |
| 92 r"Expected: return normally" | 92 r"Expected: return normally" |
| 93 r" Actual: <Closure(: \(dynamic\) => dynamic " | 93 r" Actual: <Closure(: \(\) => dynamic " |
| 94 r"from Function 'doesThrow': static\.)?>" | 94 r"from Function 'doesThrow': static\.)?>" |
| 95 r" Which: threw 'X'")); | 95 r" Which: threw 'X'")); |
| 96 }); | 96 }); |
| 97 | 97 |
| 98 | 98 |
| 99 test('hasLength', () { | 99 test('hasLength', () { |
| 100 var a = new Map(); | 100 var a = new Map(); |
| 101 var b = new List(); | 101 var b = new List(); |
| 102 shouldPass(a, hasLength(0)); | 102 shouldPass(a, hasLength(0)); |
| 103 shouldPass(b, hasLength(0)); | 103 shouldPass(b, hasLength(0)); |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 | 701 |
| 702 group('Predicate Matchers', () { | 702 group('Predicate Matchers', () { |
| 703 test('isInstanceOf', () { | 703 test('isInstanceOf', () { |
| 704 shouldFail(0, predicate((x) => x is String, "an instance of String"), | 704 shouldFail(0, predicate((x) => x is String, "an instance of String"), |
| 705 "Expected: an instance of String Actual: <0>"); | 705 "Expected: an instance of String Actual: <0>"); |
| 706 shouldPass('cow', predicate((x) => x is String, "an instance of String")); | 706 shouldPass('cow', predicate((x) => x is String, "an instance of String")); |
| 707 }); | 707 }); |
| 708 }); | 708 }); |
| 709 } | 709 } |
| 710 | 710 |
| OLD | NEW |