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 unittestTests; | 5 library unittestTests; |
6 import 'package:unittest/unittest.dart'; | 6 import 'package:unittest/unittest.dart'; |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 part 'test_utils.dart'; | 8 part 'test_utils.dart'; |
9 | 9 |
10 doesNotThrow() {} | 10 doesNotThrow() {} |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 test('throwsArgumentError', () { | 151 test('throwsArgumentError', () { |
152 shouldPass(() { throw new ArgumentError(''); }, | 152 shouldPass(() { throw new ArgumentError(''); }, |
153 throwsArgumentError); | 153 throwsArgumentError); |
154 shouldFail(() { throw new Exception(); }, | 154 shouldFail(() { throw new Exception(); }, |
155 throwsArgumentError, | 155 throwsArgumentError, |
156 "Expected: throws an exception which matches ArgumentError " | 156 "Expected: throws an exception which matches ArgumentError " |
157 "but: exception <Exception> does not match " | 157 "but: exception <Exception> does not match " |
158 "ArgumentError."); | 158 "ArgumentError."); |
159 }); | 159 }); |
160 | 160 |
161 test('throwsIllegalJSRegExpException', () { | |
162 shouldPass(() { throw new IllegalJSRegExpException('',''); }, | |
163 throwsIllegalJSRegExpException); | |
164 shouldFail(() { throw new Exception(); }, | |
165 throwsIllegalJSRegExpException, | |
166 "Expected: throws an exception which matches IllegalJSRegExpException " | |
167 "but: exception <Exception> does not match " | |
168 "IllegalJSRegExpException."); | |
169 }); | |
170 | |
171 test('throwsRangeError', () { | 161 test('throwsRangeError', () { |
172 shouldPass(() { throw new RangeError(0); }, | 162 shouldPass(() { throw new RangeError(0); }, |
173 throwsRangeError); | 163 throwsRangeError); |
174 shouldFail(() { throw new Exception(); }, | 164 shouldFail(() { throw new Exception(); }, |
175 throwsRangeError, | 165 throwsRangeError, |
176 "Expected: throws an exception which matches RangeError " | 166 "Expected: throws an exception which matches RangeError " |
177 "but: exception <Exception> does not match RangeError."); | 167 "but: exception <Exception> does not match RangeError."); |
178 }); | 168 }); |
179 | 169 |
180 test('throwsNoSuchMethodError', () { | 170 test('throwsNoSuchMethodError', () { |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 var w = new Widget(); | 702 var w = new Widget(); |
713 w.price = 10; | 703 w.price = 10; |
714 shouldPass(w, new HasPrice(greaterThan(0))); | 704 shouldPass(w, new HasPrice(greaterThan(0))); |
715 shouldFail(w, new HasPrice(greaterThan(10)), | 705 shouldFail(w, new HasPrice(greaterThan(10)), |
716 'Expected: Widget with a price that is a value greater than <10> ' | 706 'Expected: Widget with a price that is a value greater than <10> ' |
717 'but: price was <10>.'); | 707 'but: price was <10>.'); |
718 }); | 708 }); |
719 }); | 709 }); |
720 } | 710 } |
721 | 711 |
OLD | NEW |