OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library matcher.error_matchers; |
| 6 |
| 7 import 'core_matchers.dart'; |
| 8 import 'interfaces.dart'; |
| 9 |
| 10 /// A matcher for AbstractClassInstantiationError. |
| 11 @deprecated |
| 12 const isAbstractClassInstantiationError = |
| 13 const _AbstractClassInstantiationError(); |
| 14 |
| 15 /// A matcher for functions that throw AbstractClassInstantiationError. |
| 16 @deprecated |
| 17 const Matcher throwsAbstractClassInstantiationError = |
| 18 const Throws(isAbstractClassInstantiationError); |
| 19 |
| 20 class _AbstractClassInstantiationError extends TypeMatcher { |
| 21 const _AbstractClassInstantiationError() : |
| 22 super("AbstractClassInstantiationError"); |
| 23 bool matches(item, Map matchState) => item is AbstractClassInstantiationError; |
| 24 } |
| 25 |
| 26 /// A matcher for ArgumentErrors. |
| 27 const isArgumentError = const _ArgumentError(); |
| 28 |
| 29 /// A matcher for functions that throw ArgumentError. |
| 30 const Matcher throwsArgumentError = const Throws(isArgumentError); |
| 31 |
| 32 class _ArgumentError extends TypeMatcher { |
| 33 const _ArgumentError(): super("ArgumentError"); |
| 34 bool matches(item, Map matchState) => item is ArgumentError; |
| 35 } |
| 36 |
| 37 /// A matcher for ConcurrentModificationError. |
| 38 const isConcurrentModificationError = const _ConcurrentModificationError(); |
| 39 |
| 40 /// A matcher for functions that throw ConcurrentModificationError. |
| 41 const Matcher throwsConcurrentModificationError = |
| 42 const Throws(isConcurrentModificationError); |
| 43 |
| 44 class _ConcurrentModificationError extends TypeMatcher { |
| 45 const _ConcurrentModificationError(): super("ConcurrentModificationError"); |
| 46 bool matches(item, Map matchState) => item is ConcurrentModificationError; |
| 47 } |
| 48 |
| 49 /// A matcher for CyclicInitializationError. |
| 50 const isCyclicInitializationError = const _CyclicInitializationError(); |
| 51 |
| 52 /// A matcher for functions that throw CyclicInitializationError. |
| 53 const Matcher throwsCyclicInitializationError = |
| 54 const Throws(isCyclicInitializationError); |
| 55 |
| 56 class _CyclicInitializationError extends TypeMatcher { |
| 57 const _CyclicInitializationError(): super("CyclicInitializationError"); |
| 58 bool matches(item, Map matchState) => item is CyclicInitializationError; |
| 59 } |
| 60 |
| 61 /// A matcher for Exceptions. |
| 62 const isException = const _Exception(); |
| 63 |
| 64 /// A matcher for functions that throw Exception. |
| 65 const Matcher throwsException = const Throws(isException); |
| 66 |
| 67 class _Exception extends TypeMatcher { |
| 68 const _Exception(): super("Exception"); |
| 69 bool matches(item, Map matchState) => item is Exception; |
| 70 } |
| 71 |
| 72 /// A matcher for FallThroughError. |
| 73 @deprecated |
| 74 const isFallThroughError = const _FallThroughError(); |
| 75 |
| 76 /// A matcher for functions that throw FallThroughError. |
| 77 @deprecated |
| 78 const Matcher throwsFallThroughError = const Throws(isFallThroughError); |
| 79 |
| 80 class _FallThroughError extends TypeMatcher { |
| 81 const _FallThroughError(): super("FallThroughError"); |
| 82 bool matches(item, Map matchState) => item is FallThroughError; |
| 83 } |
| 84 |
| 85 /// A matcher for FormatExceptions. |
| 86 const isFormatException = const _FormatException(); |
| 87 |
| 88 /// A matcher for functions that throw FormatException. |
| 89 const Matcher throwsFormatException = const Throws(isFormatException); |
| 90 |
| 91 class _FormatException extends TypeMatcher { |
| 92 const _FormatException(): super("FormatException"); |
| 93 bool matches(item, Map matchState) => item is FormatException; |
| 94 } |
| 95 |
| 96 /// A matcher for NoSuchMethodErrors. |
| 97 const isNoSuchMethodError = const _NoSuchMethodError(); |
| 98 |
| 99 /// A matcher for functions that throw NoSuchMethodError. |
| 100 const Matcher throwsNoSuchMethodError = const Throws(isNoSuchMethodError); |
| 101 |
| 102 class _NoSuchMethodError extends TypeMatcher { |
| 103 const _NoSuchMethodError(): super("NoSuchMethodError"); |
| 104 bool matches(item, Map matchState) => item is NoSuchMethodError; |
| 105 } |
| 106 |
| 107 /// A matcher for NullThrownError. |
| 108 const isNullThrownError = const _NullThrownError(); |
| 109 |
| 110 /// A matcher for functions that throw NullThrownError. |
| 111 const Matcher throwsNullThrownError = const Throws(isNullThrownError); |
| 112 |
| 113 class _NullThrownError extends TypeMatcher { |
| 114 const _NullThrownError(): super("NullThrownError"); |
| 115 bool matches(item, Map matchState) => item is NullThrownError; |
| 116 } |
| 117 |
| 118 /// A matcher for RangeErrors. |
| 119 const isRangeError = const _RangeError(); |
| 120 |
| 121 /// A matcher for functions that throw RangeError. |
| 122 const Matcher throwsRangeError = const Throws(isRangeError); |
| 123 |
| 124 class _RangeError extends TypeMatcher { |
| 125 const _RangeError(): super("RangeError"); |
| 126 bool matches(item, Map matchState) => item is RangeError; |
| 127 } |
| 128 |
| 129 /// A matcher for StateErrors. |
| 130 const isStateError = const _StateError(); |
| 131 |
| 132 /// A matcher for functions that throw StateError. |
| 133 const Matcher throwsStateError = const Throws(isStateError); |
| 134 |
| 135 class _StateError extends TypeMatcher { |
| 136 const _StateError(): super("StateError"); |
| 137 bool matches(item, Map matchState) => item is StateError; |
| 138 } |
| 139 |
| 140 /// A matcher for UnimplementedErrors. |
| 141 const isUnimplementedError = const _UnimplementedError(); |
| 142 |
| 143 /// A matcher for functions that throw Exception. |
| 144 const Matcher throwsUnimplementedError = const Throws(isUnimplementedError); |
| 145 |
| 146 class _UnimplementedError extends TypeMatcher { |
| 147 const _UnimplementedError(): super("UnimplementedError"); |
| 148 bool matches(item, Map matchState) => item is UnimplementedError; |
| 149 } |
| 150 |
| 151 /// A matcher for UnsupportedError. |
| 152 const isUnsupportedError = const _UnsupportedError(); |
| 153 |
| 154 /// A matcher for functions that throw UnsupportedError. |
| 155 const Matcher throwsUnsupportedError = const Throws(isUnsupportedError); |
| 156 |
| 157 class _UnsupportedError extends TypeMatcher { |
| 158 const _UnsupportedError(): super("UnsupportedError"); |
| 159 bool matches(item, Map matchState) => item is UnsupportedError; |
| 160 } |
OLD | NEW |