| 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 normally fail when run in minified dart2js, since the names will | 6 // These tests normally fail when run in minified dart2js, since the names will |
| 7 // be mangled. This version of the file is modified to expect minified names. | 7 // be mangled. This version of the file is modified to expect minified names. |
| 8 | 8 |
| 9 library matcher.minified_test; | 9 library matcher.minified_test; |
| 10 | 10 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, | 108 shouldFail(e, isEmpty, |
| 109 matches(r"Expected: empty +Actual: " + _MINIFIED_NAME + r":\[1\]")); | 109 matches(r"Expected: empty +Actual: " + _MINIFIED_NAME + r":\[1\]")); |
| 110 }); | 110 }); |
| 111 | 111 |
| 112 test('isNotEmpty', () { |
| 113 var d = new SimpleIterable(0); |
| 114 var e = new SimpleIterable(1); |
| 115 shouldPass(e, isNotEmpty); |
| 116 shouldFail(d, isNotEmpty, |
| 117 matches(r"Expected: non-empty +Actual: " + _MINIFIED_NAME + r":\[\]"))
; |
| 118 }); |
| 119 |
| 112 test('contains', () { | 120 test('contains', () { |
| 113 var d = new SimpleIterable(3); | 121 var d = new SimpleIterable(3); |
| 114 shouldPass(d, contains(2)); | 122 shouldPass(d, contains(2)); |
| 115 shouldFail(d, contains(5), | 123 shouldFail(d, contains(5), |
| 116 matches( | 124 matches( |
| 117 r"Expected: contains <5> +" | 125 r"Expected: contains <5> +" |
| 118 r"Actual: " + _MINIFIED_NAME + r":\[3, 2, 1\]")); | 126 r"Actual: " + _MINIFIED_NAME + r":\[3, 2, 1\]")); |
| 119 }); | 127 }); |
| 120 }); | 128 }); |
| 121 | 129 |
| 122 group('Feature Matchers', () { | 130 group('Feature Matchers', () { |
| 123 test("Feature Matcher", () { | 131 test("Feature Matcher", () { |
| 124 var w = new Widget(); | 132 var w = new Widget(); |
| 125 w.price = 10; | 133 w.price = 10; |
| 126 shouldPass(w, new HasPrice(10)); | 134 shouldPass(w, new HasPrice(10)); |
| 127 shouldPass(w, new HasPrice(greaterThan(0))); | 135 shouldPass(w, new HasPrice(greaterThan(0))); |
| 128 shouldFail(w, new HasPrice(greaterThan(10)), | 136 shouldFail(w, new HasPrice(greaterThan(10)), |
| 129 matches( | 137 matches( |
| 130 r"Expected: Widget with a price that is a value greater than " | 138 r"Expected: Widget with a price that is a value greater than " |
| 131 r"<10> +" | 139 r"<10> +" |
| 132 r"Actual: <Instance of '" + _MINIFIED_NAME + r"'> +" | 140 r"Actual: <Instance of '" + _MINIFIED_NAME + r"'> +" |
| 133 r"Which: has price with value <10> which is not " | 141 r"Which: has price with value <10> which is not " |
| 134 r"a value greater than <10>")); | 142 r"a value greater than <10>")); |
| 135 }); | 143 }); |
| 136 }); | 144 }); |
| 137 } | 145 } |
| OLD | NEW |