| 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 matcher.error_matchers; | 5 library matcher.error_matchers; |
| 6 | 6 |
| 7 import 'core_matchers.dart'; | 7 import 'core_matchers.dart'; |
| 8 import 'interfaces.dart'; | 8 import 'interfaces.dart'; |
| 9 | 9 |
| 10 /// **DEPRECATED** | |
| 11 /// | |
| 12 /// Will be removed in the next major release. | |
| 13 // TODO(kevmoo): re-deprecate once 19173 is resolved | |
| 14 //@deprecated | |
| 15 const Matcher isAbstractClassInstantiationError = | |
| 16 const _AbstractClassInstantiationError(); | |
| 17 | |
| 18 /// **DEPRECATED** | |
| 19 /// | |
| 20 /// Will be removed in the next major release. | |
| 21 // TODO(kevmoo): re-deprecate once 19173 is resolved | |
| 22 //@deprecated | |
| 23 const Matcher throwsAbstractClassInstantiationError = | |
| 24 const Throws(isAbstractClassInstantiationError); | |
| 25 | |
| 26 class _AbstractClassInstantiationError extends TypeMatcher { | |
| 27 const _AbstractClassInstantiationError() : | |
| 28 super("AbstractClassInstantiationError"); | |
| 29 bool matches(item, Map matchState) => item is AbstractClassInstantiationError; | |
| 30 } | |
| 31 | |
| 32 /// A matcher for ArgumentErrors. | 10 /// A matcher for ArgumentErrors. |
| 33 const Matcher isArgumentError = const _ArgumentError(); | 11 const Matcher isArgumentError = const _ArgumentError(); |
| 34 | 12 |
| 35 /// A matcher for functions that throw ArgumentError. | 13 /// A matcher for functions that throw ArgumentError. |
| 36 const Matcher throwsArgumentError = const Throws(isArgumentError); | 14 const Matcher throwsArgumentError = const Throws(isArgumentError); |
| 37 | 15 |
| 38 class _ArgumentError extends TypeMatcher { | 16 class _ArgumentError extends TypeMatcher { |
| 39 const _ArgumentError(): super("ArgumentError"); | 17 const _ArgumentError(): super("ArgumentError"); |
| 40 bool matches(item, Map matchState) => item is ArgumentError; | 18 bool matches(item, Map matchState) => item is ArgumentError; |
| 41 } | 19 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 69 const Matcher isException = const _Exception(); | 47 const Matcher isException = const _Exception(); |
| 70 | 48 |
| 71 /// A matcher for functions that throw Exception. | 49 /// A matcher for functions that throw Exception. |
| 72 const Matcher throwsException = const Throws(isException); | 50 const Matcher throwsException = const Throws(isException); |
| 73 | 51 |
| 74 class _Exception extends TypeMatcher { | 52 class _Exception extends TypeMatcher { |
| 75 const _Exception(): super("Exception"); | 53 const _Exception(): super("Exception"); |
| 76 bool matches(item, Map matchState) => item is Exception; | 54 bool matches(item, Map matchState) => item is Exception; |
| 77 } | 55 } |
| 78 | 56 |
| 79 /// **DEPRECATED** | |
| 80 /// | |
| 81 /// Will be removed in the next major release. | |
| 82 // TODO(kevmoo): re-deprecate once 19173 is resolved | |
| 83 //@deprecated | |
| 84 const Matcher isFallThroughError = const _FallThroughError(); | |
| 85 | |
| 86 /// **DEPRECATED** | |
| 87 /// | |
| 88 /// Will be removed in the next major release. | |
| 89 // TODO(kevmoo): re-deprecate once 19173 is resolved | |
| 90 //@deprecated | |
| 91 const Matcher throwsFallThroughError = const Throws(isFallThroughError); | |
| 92 | |
| 93 class _FallThroughError extends TypeMatcher { | 57 class _FallThroughError extends TypeMatcher { |
| 94 const _FallThroughError(): super("FallThroughError"); | 58 const _FallThroughError(): super("FallThroughError"); |
| 95 bool matches(item, Map matchState) => item is FallThroughError; | 59 bool matches(item, Map matchState) => item is FallThroughError; |
| 96 } | 60 } |
| 97 | 61 |
| 98 /// A matcher for FormatExceptions. | 62 /// A matcher for FormatExceptions. |
| 99 const Matcher isFormatException = const _FormatException(); | 63 const Matcher isFormatException = const _FormatException(); |
| 100 | 64 |
| 101 /// A matcher for functions that throw FormatException. | 65 /// A matcher for functions that throw FormatException. |
| 102 const Matcher throwsFormatException = const Throws(isFormatException); | 66 const Matcher throwsFormatException = const Throws(isFormatException); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 /// A matcher for UnsupportedError. | 128 /// A matcher for UnsupportedError. |
| 165 const Matcher isUnsupportedError = const _UnsupportedError(); | 129 const Matcher isUnsupportedError = const _UnsupportedError(); |
| 166 | 130 |
| 167 /// A matcher for functions that throw UnsupportedError. | 131 /// A matcher for functions that throw UnsupportedError. |
| 168 const Matcher throwsUnsupportedError = const Throws(isUnsupportedError); | 132 const Matcher throwsUnsupportedError = const Throws(isUnsupportedError); |
| 169 | 133 |
| 170 class _UnsupportedError extends TypeMatcher { | 134 class _UnsupportedError extends TypeMatcher { |
| 171 const _UnsupportedError(): super("UnsupportedError"); | 135 const _UnsupportedError(): super("UnsupportedError"); |
| 172 bool matches(item, Map matchState) => item is UnsupportedError; | 136 bool matches(item, Map matchState) => item is UnsupportedError; |
| 173 } | 137 } |
| OLD | NEW |