| 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 #library('matcherTest'); | 5 #library('matcherTest'); |
| 6 #import('../../../pkg/unittest/unittest.dart'); | 6 #import('../../../pkg/unittest/unittest.dart'); |
| 7 #source('test_utils.dart'); | 7 #source('test_utils.dart'); |
| 8 | 8 |
| 9 doesNotThrow() {} | 9 doesNotThrow() {} |
| 10 doesThrow() { throw 'X'; } | 10 doesThrow() { throw 'X'; } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 test('throwsIllegalJSRegExpException', () { | 118 test('throwsIllegalJSRegExpException', () { |
| 119 shouldPass(() { throw new IllegalJSRegExpException('',''); }, | 119 shouldPass(() { throw new IllegalJSRegExpException('',''); }, |
| 120 throwsIllegalJSRegExpException); | 120 throwsIllegalJSRegExpException); |
| 121 shouldFail(() { throw new Exception(); }, | 121 shouldFail(() { throw new Exception(); }, |
| 122 throwsIllegalJSRegExpException, | 122 throwsIllegalJSRegExpException, |
| 123 "Expected: throws an exception which matches IllegalJSRegExpException " | 123 "Expected: throws an exception which matches IllegalJSRegExpException " |
| 124 "but: exception <Exception> does not match " | 124 "but: exception <Exception> does not match " |
| 125 "IllegalJSRegExpException."); | 125 "IllegalJSRegExpException."); |
| 126 }); | 126 }); |
| 127 | 127 |
| 128 test('throwsIndexOutOfRangeException', () { | 128 test('throwsRangeError', () { |
| 129 shouldPass(() { throw new IndexOutOfRangeException(0); }, | 129 shouldPass(() { throw new RangeError.value(0); }, |
| 130 throwsIndexOutOfRangeException); | 130 throwsRangeError); |
| 131 shouldFail(() { throw new Exception(); }, | 131 shouldFail(() { throw new Exception(); }, |
| 132 throwsIndexOutOfRangeException, | 132 throwsRangeError, |
| 133 "Expected: throws an exception which matches IndexOutOfRangeException " | 133 "Expected: throws an exception which matches RangeError " |
| 134 "but: exception <Exception> does not match " | 134 "but: exception <Exception> does not match " |
| 135 "IndexOutOfRangeException."); | 135 "RangeError."); |
| 136 }); | 136 }); |
| 137 | 137 |
| 138 test('throwsNoSuchMethodError', () { | 138 test('throwsNoSuchMethodError', () { |
| 139 shouldPass(() { throw new NoSuchMethodError(null, '', null); }, | 139 shouldPass(() { throw new NoSuchMethodError(null, '', null); }, |
| 140 throwsNoSuchMethodError); | 140 throwsNoSuchMethodError); |
| 141 shouldFail(() { throw new Exception(); }, | 141 shouldFail(() { throw new Exception(); }, |
| 142 throwsNoSuchMethodError, | 142 throwsNoSuchMethodError, |
| 143 "Expected: throws an exception which matches NoSuchMethodError " | 143 "Expected: throws an exception which matches NoSuchMethodError " |
| 144 "but: exception <Exception> does not match " | 144 "but: exception <Exception> does not match " |
| 145 "NoSuchMethodError."); | 145 "NoSuchMethodError."); |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 var w = new Widget(); | 537 var w = new Widget(); |
| 538 w.price = 10; | 538 w.price = 10; |
| 539 shouldPass(w, new HasPrice(greaterThan(0))); | 539 shouldPass(w, new HasPrice(greaterThan(0))); |
| 540 shouldFail(w, new HasPrice(greaterThan(10)), | 540 shouldFail(w, new HasPrice(greaterThan(10)), |
| 541 'Expected: Widget with a price that is a value greater than <10> ' | 541 'Expected: Widget with a price that is a value greater than <10> ' |
| 542 'but: price was <10>.'); | 542 'but: price was <10>.'); |
| 543 }); | 543 }); |
| 544 }); | 544 }); |
| 545 } | 545 } |
| 546 | 546 |
| OLD | NEW |