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 library matcher.unminified_test; | 10 library matcher.unminified_test; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 | 101 |
102 group('Iterable Matchers', () { | 102 group('Iterable Matchers', () { |
103 test('isEmpty', () { | 103 test('isEmpty', () { |
104 var d = new SimpleIterable(0); | 104 var d = new SimpleIterable(0); |
105 var e = new SimpleIterable(1); | 105 var e = new SimpleIterable(1); |
106 shouldPass(d, isEmpty); | 106 shouldPass(d, isEmpty); |
107 shouldFail(e, isEmpty, "Expected: empty " | 107 shouldFail(e, isEmpty, "Expected: empty " |
108 "Actual: SimpleIterable:[1]"); | 108 "Actual: SimpleIterable:[1]"); |
109 }); | 109 }); |
110 | 110 |
111 test('isNotEmpty', () { | |
112 var d = new SimpleIterable(0); | |
113 var e = new SimpleIterable(1); | |
114 shouldPass(e, isNotEmpty); | |
115 shouldFail(d, isNotEmpty, "Expected: non-empty " | |
116 "Actual: SimpleIterable:[]"); | |
117 }); | |
118 | |
119 | |
nweiz
2014/12/01 22:18:07
Nit: extra newline
blackhc
2014/12/03 10:07:17
Done.
| |
111 test('contains', () { | 120 test('contains', () { |
112 var d = new SimpleIterable(3); | 121 var d = new SimpleIterable(3); |
113 shouldPass(d, contains(2)); | 122 shouldPass(d, contains(2)); |
114 shouldFail(d, contains(5), | 123 shouldFail(d, contains(5), |
115 "Expected: contains <5> " | 124 "Expected: contains <5> " |
116 "Actual: SimpleIterable:[3, 2, 1]"); | 125 "Actual: SimpleIterable:[3, 2, 1]"); |
117 }); | 126 }); |
118 }); | 127 }); |
119 | 128 |
120 group('Feature Matchers', () { | 129 group('Feature Matchers', () { |
121 test("Feature Matcher", () { | 130 test("Feature Matcher", () { |
122 var w = new Widget(); | 131 var w = new Widget(); |
123 w.price = 10; | 132 w.price = 10; |
124 shouldPass(w, new HasPrice(10)); | 133 shouldPass(w, new HasPrice(10)); |
125 shouldPass(w, new HasPrice(greaterThan(0))); | 134 shouldPass(w, new HasPrice(greaterThan(0))); |
126 shouldFail(w, new HasPrice(greaterThan(10)), | 135 shouldFail(w, new HasPrice(greaterThan(10)), |
127 "Expected: Widget with a price that is a value greater than <10> " | 136 "Expected: Widget with a price that is a value greater than <10> " |
128 "Actual: <Instance of 'Widget'> " | 137 "Actual: <Instance of 'Widget'> " |
129 "Which: has price with value <10> which is not " | 138 "Which: has price with value <10> which is not " |
130 "a value greater than <10>"); | 139 "a value greater than <10>"); |
131 }); | 140 }); |
132 }); | 141 }); |
133 } | 142 } |
OLD | NEW |