| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 test('throwsNullPointerException', () { | 148 test('throwsNullPointerException', () { |
| 149 shouldPass(() { throw new NullPointerException(''); }, | 149 shouldPass(() { throw new NullPointerException(''); }, |
| 150 throwsNullPointerException); | 150 throwsNullPointerException); |
| 151 shouldFail(() { throw new Exception(); }, | 151 shouldFail(() { throw new Exception(); }, |
| 152 throwsNullPointerException, | 152 throwsNullPointerException, |
| 153 "Expected: throws an exception which matches NullPointerException " | 153 "Expected: throws an exception which matches NullPointerException " |
| 154 "but: exception <Exception> does not match " | 154 "but: exception <Exception> does not match " |
| 155 "NullPointerException."); | 155 "NullPointerException."); |
| 156 }); | 156 }); |
| 157 | 157 |
| 158 test('throwsUnsupportedOperationException', () { | 158 test('throwsUnsupportedError', () { |
| 159 shouldPass(() { throw new UnsupportedOperationException(''); }, | 159 shouldPass(() { throw new UnsupportedError(''); }, |
| 160 throwsUnsupportedOperationException); | 160 throwsUnsupportedError); |
| 161 shouldFail(() { throw new Exception(); }, | 161 shouldFail(() { throw new Exception(); }, |
| 162 throwsUnsupportedOperationException, | 162 throwsUnsupportedError, |
| 163 "Expected: throws an exception which matches " | 163 "Expected: throws an exception which matches " |
| 164 "UnsupportedOperationException " | 164 "UnsupportedError " |
| 165 "but: exception <Exception> does not match " | 165 "but: exception <Exception> does not match " |
| 166 "UnsupportedOperationException."); | 166 "UnsupportedError."); |
| 167 }); | 167 }); |
| 168 | 168 |
| 169 test('returnsNormally', () { | 169 test('returnsNormally', () { |
| 170 shouldPass(doesNotThrow, returnsNormally); | 170 shouldPass(doesNotThrow, returnsNormally); |
| 171 shouldFail(doesThrow, returnsNormally, | 171 shouldFail(doesThrow, returnsNormally, |
| 172 "Expected: return normally but: threw 'X'."); | 172 "Expected: return normally but: threw 'X'."); |
| 173 }); | 173 }); |
| 174 | 174 |
| 175 test('hasLength', () { | 175 test('hasLength', () { |
| 176 var a = new Map(); | 176 var a = new Map(); |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 test('isInstanceOf', () { | 519 test('isInstanceOf', () { |
| 520 shouldFail(0, predicate((x) => x is String, | 520 shouldFail(0, predicate((x) => x is String, |
| 521 description: "an instance of String"), | 521 description: "an instance of String"), |
| 522 "Expected: an instance of String but: was <0>."); | 522 "Expected: an instance of String but: was <0>."); |
| 523 shouldPass('cow', predicate((x) => x is String, | 523 shouldPass('cow', predicate((x) => x is String, |
| 524 description: "an instance of String")); | 524 description: "an instance of String")); |
| 525 }); | 525 }); |
| 526 }); | 526 }); |
| 527 } | 527 } |
| 528 | 528 |
| OLD | NEW |