| 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 '../../../pkg/unittest/lib/unittest.dart'; | 6 import '../../../pkg/unittest/lib/unittest.dart'; |
| 7 part 'test_utils.dart'; | 7 part 'test_utils.dart'; |
| 8 | 8 |
| 9 doesNotThrow() {} | 9 doesNotThrow() {} |
| 10 doesThrow() { throw 'X'; } | 10 doesThrow() { throw 'X'; } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 test('throwsUnimplementedError', () { | 148 test('throwsUnimplementedError', () { |
| 149 shouldPass(() { throw new UnimplementedError(''); }, | 149 shouldPass(() { throw new UnimplementedError(''); }, |
| 150 throwsUnimplementedError); | 150 throwsUnimplementedError); |
| 151 shouldFail(() { throw new Exception(); }, | 151 shouldFail(() { throw new Exception(); }, |
| 152 throwsUnimplementedError, | 152 throwsUnimplementedError, |
| 153 "Expected: throws an exception which matches UnimplementedError " | 153 "Expected: throws an exception which matches UnimplementedError " |
| 154 "but: exception <Exception> does not match " | 154 "but: exception <Exception> does not match " |
| 155 "UnimplementedError."); | 155 "UnimplementedError."); |
| 156 }); | 156 }); |
| 157 | 157 |
| 158 test('throwsNullPointerException', () { | |
| 159 shouldPass(() { throw new NullPointerException(''); }, | |
| 160 throwsNullPointerException); | |
| 161 shouldFail(() { throw new Exception(); }, | |
| 162 throwsNullPointerException, | |
| 163 "Expected: throws an exception which matches NullPointerException " | |
| 164 "but: exception <Exception> does not match " | |
| 165 "NullPointerException."); | |
| 166 }); | |
| 167 | |
| 168 test('throwsUnsupportedError', () { | 158 test('throwsUnsupportedError', () { |
| 169 shouldPass(() { throw new UnsupportedError(''); }, | 159 shouldPass(() { throw new UnsupportedError(''); }, |
| 170 throwsUnsupportedError); | 160 throwsUnsupportedError); |
| 171 shouldFail(() { throw new Exception(); }, | 161 shouldFail(() { throw new Exception(); }, |
| 172 throwsUnsupportedError, | 162 throwsUnsupportedError, |
| 173 "Expected: throws an exception which matches UnsupportedError " | 163 "Expected: throws an exception which matches UnsupportedError " |
| 174 "but: exception <Exception> does not match " | 164 "but: exception <Exception> does not match " |
| 175 "UnsupportedError."); | 165 "UnsupportedError."); |
| 176 }); | 166 }); |
| 177 | 167 |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 var w = new Widget(); | 527 var w = new Widget(); |
| 538 w.price = 10; | 528 w.price = 10; |
| 539 shouldPass(w, new HasPrice(greaterThan(0))); | 529 shouldPass(w, new HasPrice(greaterThan(0))); |
| 540 shouldFail(w, new HasPrice(greaterThan(10)), | 530 shouldFail(w, new HasPrice(greaterThan(10)), |
| 541 'Expected: Widget with a price that is a value greater than <10> ' | 531 'Expected: Widget with a price that is a value greater than <10> ' |
| 542 'but: price was <10>.'); | 532 'but: price was <10>.'); |
| 543 }); | 533 }); |
| 544 }); | 534 }); |
| 545 } | 535 } |
| 546 | 536 |
| OLD | NEW |