| 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 // This file is for matcher tests that rely on the names of various Dart types. | 5 // This file is for matcher tests that rely on the names of various Dart types. |
| 6 // These tests will fail when run in minified dart2js, since the names will be | 6 // These tests will fail when run in minified dart2js, since the names will be |
| 7 // mangled. A version of this file that works in minified dart2js is in | 7 // mangled. A version of this file that works in minified dart2js is in |
| 8 // matchers_minified_test.dart. | 8 // matchers_minified_test.dart. |
| 9 | 9 |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 r"StateError\." | 98 r"StateError\." |
| 99 r"Actual: <Closure(: \(dynamic\) => dynamic)?>")); | 99 r"Actual: <Closure(: \(dynamic\) => dynamic)?>")); |
| 100 }); | 100 }); |
| 101 }); | 101 }); |
| 102 | 102 |
| 103 group('Iterable Matchers', () { | 103 group('Iterable Matchers', () { |
| 104 test('isEmpty', () { | 104 test('isEmpty', () { |
| 105 var d = new SimpleIterable(0); | 105 var d = new SimpleIterable(0); |
| 106 var e = new SimpleIterable(1); | 106 var e = new SimpleIterable(1); |
| 107 shouldPass(d, isEmpty); | 107 shouldPass(d, isEmpty); |
| 108 shouldFail(e, isEmpty, "Expected: empty But: was SimpleIterable:[1]."); | 108 shouldFail(e, isEmpty, "Expected: empty " |
| 109 "But: was SimpleIterable:[1]. " |
| 110 "Actual: SimpleIterable:[1]"); |
| 109 }); | 111 }); |
| 110 | 112 |
| 111 test('contains', () { | 113 test('contains', () { |
| 112 var d = new SimpleIterable(3); | 114 var d = new SimpleIterable(3); |
| 113 shouldPass(d, contains(2)); | 115 shouldPass(d, contains(2)); |
| 114 shouldFail(d, contains(5), | 116 shouldFail(d, contains(5), |
| 115 "Expected: contains <5> " | 117 "Expected: contains <5> " |
| 116 "But: was SimpleIterable:[3, 2, 1]."); | 118 "But: was SimpleIterable:[3, 2, 1]. " |
| 119 "Actual: SimpleIterable:[3, 2, 1]"); |
| 117 }); | 120 }); |
| 118 }); | 121 }); |
| 119 | 122 |
| 120 group('Feature Matchers', () { | 123 group('Feature Matchers', () { |
| 121 test("Feature Matcher", () { | 124 test("Feature Matcher", () { |
| 122 var w = new Widget(); | 125 var w = new Widget(); |
| 123 w.price = 10; | 126 w.price = 10; |
| 124 shouldPass(w, new HasPrice(10)); | 127 shouldPass(w, new HasPrice(10)); |
| 125 shouldPass(w, new HasPrice(greaterThan(0))); | 128 shouldPass(w, new HasPrice(greaterThan(0))); |
| 126 shouldFail(w, new HasPrice(greaterThan(10)), | 129 shouldFail(w, new HasPrice(greaterThan(10)), |
| 127 "Expected: Widget with a price that is a value greater than <10> " | 130 "Expected: Widget with a price that is a value greater than <10> " |
| 128 "But: price was <10>. " | 131 "But: price was <10>. " |
| 129 "Actual: <Instance of 'Widget'>"); | 132 "Actual: <Instance of 'Widget'>"); |
| 130 }); | 133 }); |
| 131 }); | 134 }); |
| 132 } | 135 } |
| OLD | NEW |