| 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('throwsIndexOutOfRangeException', () { | 118 test('throwsIndexOutOfRangeException', () { |
| 119 shouldPass(() { throw new IndexOutOfRangeException(0); }, | 119 shouldPass(() { throw new IndexOutOfRangeException(0); }, |
| 120 throwsIndexOutOfRangeException); | 120 throwsIndexOutOfRangeException); |
| 121 shouldFail(() { throw new Exception(); }, | 121 shouldFail(() { throw new Exception(); }, |
| 122 throwsIndexOutOfRangeException, | 122 throwsIndexOutOfRangeException, |
| 123 "Expected: throws an exception which matches IndexOutOfRangeException " | 123 "Expected: throws an exception which matches IndexOutOfRangeException " |
| 124 "but: exception <Exception> does not match " | 124 "but: exception <Exception> does not match " |
| 125 "IndexOutOfRangeException."); | 125 "IndexOutOfRangeException."); |
| 126 }); | 126 }); |
| 127 | 127 |
| 128 test('throwsNoSuchMethodException', () { | 128 test('throwsNoSuchMethodError', () { |
| 129 shouldPass(() { throw new NoSuchMethodException(null, '', null); }, | 129 shouldPass(() { throw new NoSuchMethodError(null, '', null); }, |
| 130 throwsNoSuchMethodException); | 130 throwsNoSuchMethodError); |
| 131 shouldFail(() { throw new Exception(); }, | 131 shouldFail(() { throw new Exception(); }, |
| 132 throwsNoSuchMethodException, | 132 throwsNoSuchMethodError, |
| 133 "Expected: throws an exception which matches NoSuchMethodException " | 133 "Expected: throws an exception which matches NoSuchMethodError " |
| 134 "but: exception <Exception> does not match " | 134 "but: exception <Exception> does not match " |
| 135 "NoSuchMethodException."); | 135 "NoSuchMethodError."); |
| 136 }); | 136 }); |
| 137 | 137 |
| 138 test('throwsNotImplementedException', () { | 138 test('throwsNotImplementedException', () { |
| 139 shouldPass(() { throw new NotImplementedException(''); }, | 139 shouldPass(() { throw new NotImplementedException(''); }, |
| 140 throwsNotImplementedException); | 140 throwsNotImplementedException); |
| 141 shouldFail(() { throw new Exception(); }, | 141 shouldFail(() { throw new Exception(); }, |
| 142 throwsNotImplementedException, | 142 throwsNotImplementedException, |
| 143 "Expected: throws an exception which matches NotImplementedException " | 143 "Expected: throws an exception which matches NotImplementedException " |
| 144 "but: exception <Exception> does not match " | 144 "but: exception <Exception> does not match " |
| 145 "NotImplementedException."); | 145 "NotImplementedException."); |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 | 517 |
| 518 group('Predicate Matchers', () { | 518 group('Predicate Matchers', () { |
| 519 test('isInstanceOf', () { | 519 test('isInstanceOf', () { |
| 520 shouldFail(0, predicate((x) => x is String, "an instance of String"), | 520 shouldFail(0, predicate((x) => x is String, "an instance of String"), |
| 521 "Expected: an instance of String but: was <0>."); | 521 "Expected: an instance of String but: was <0>."); |
| 522 shouldPass('cow', predicate((x) => x is String, "an instance of String")); | 522 shouldPass('cow', predicate((x) => x is String, "an instance of String")); |
| 523 }); | 523 }); |
| 524 }); | 524 }); |
| 525 } | 525 } |
| 526 | 526 |
| OLD | NEW |