| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 test('throwsFormatException', () { | 89 test('throwsFormatException', () { |
| 90 shouldPass(() { throw new FormatException(''); }, | 90 shouldPass(() { throw new FormatException(''); }, |
| 91 throwsFormatException); | 91 throwsFormatException); |
| 92 shouldFail(() { throw new Exception(); }, | 92 shouldFail(() { throw new Exception(); }, |
| 93 throwsFormatException, | 93 throwsFormatException, |
| 94 "Expected: throws an exception which matches FormatException " | 94 "Expected: throws an exception which matches FormatException " |
| 95 "but: exception <Exception> does not match FormatException."); | 95 "but: exception <Exception> does not match FormatException."); |
| 96 }); | 96 }); |
| 97 | 97 |
| 98 test('throwsIllegalArgumentException', () { | 98 test('throwsArgumentError', () { |
| 99 shouldPass(() { throw new IllegalArgumentException(''); }, | 99 shouldPass(() { throw new ArgumentError(''); }, |
| 100 throwsIllegalArgumentException); | 100 throwsArgumentError); |
| 101 shouldFail(() { throw new Exception(); }, | 101 shouldFail(() { throw new Exception(); }, |
| 102 throwsIllegalArgumentException, | 102 throwsArgumentError, |
| 103 "Expected: throws an exception which matches IllegalArgumentException " | 103 "Expected: throws an exception which matches ArgumentError " |
| 104 "but: exception <Exception> does not match " | 104 "but: exception <Exception> does not match " |
| 105 "IllegalArgumentException."); | 105 "ArgumentError."); |
| 106 }); | 106 }); |
| 107 | 107 |
| 108 test('throwsIllegalJSRegExpException', () { | 108 test('throwsIllegalJSRegExpException', () { |
| 109 shouldPass(() { throw new IllegalJSRegExpException('',''); }, | 109 shouldPass(() { throw new IllegalJSRegExpException('',''); }, |
| 110 throwsIllegalJSRegExpException); | 110 throwsIllegalJSRegExpException); |
| 111 shouldFail(() { throw new Exception(); }, | 111 shouldFail(() { throw new Exception(); }, |
| 112 throwsIllegalJSRegExpException, | 112 throwsIllegalJSRegExpException, |
| 113 "Expected: throws an exception which matches IllegalJSRegExpException " | 113 "Expected: throws an exception which matches IllegalJSRegExpException " |
| 114 "but: exception <Exception> does not match " | 114 "but: exception <Exception> does not match " |
| 115 "IllegalJSRegExpException."); | 115 "IllegalJSRegExpException."); |
| (...skipping 401 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 |