| 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 Matcher 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 Matcher 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 Matcher isConcurrentModificationError = | |
| 39 const _ConcurrentModificationError(); | |
| 40 | |
| 41 /// A matcher for functions that throw ConcurrentModificationError. | |
| 42 const Matcher throwsConcurrentModificationError = | |
| 43 const Throws(isConcurrentModificationError); | |
| 44 | |
| 45 class _ConcurrentModificationError extends TypeMatcher { | |
| 46 const _ConcurrentModificationError(): super("ConcurrentModificationError"); | |
| 47 bool matches(item, Map matchState) => item is ConcurrentModificationError; | |
| 48 } | |
| 49 | |
| 50 /// A matcher for CyclicInitializationError. | |
| 51 const Matcher isCyclicInitializationError = const _CyclicInitializationError(); | |
| 52 | |
| 53 /// A matcher for functions that throw CyclicInitializationError. | |
| 54 const Matcher throwsCyclicInitializationError = | |
| 55 const Throws(isCyclicInitializationError); | |
| 56 | |
| 57 class _CyclicInitializationError extends TypeMatcher { | |
| 58 const _CyclicInitializationError(): super("CyclicInitializationError"); | |
| 59 bool matches(item, Map matchState) => item is CyclicInitializationError; | |
| 60 } | |
| 61 | |
| 62 /// A matcher for Exceptions. | |
| 63 const Matcher isException = const _Exception(); | |
| 64 | |
| 65 /// A matcher for functions that throw Exception. | |
| 66 const Matcher throwsException = const Throws(isException); | |
| 67 | |
| 68 class _Exception extends TypeMatcher { | |
| 69 const _Exception(): super("Exception"); | |
| 70 bool matches(item, Map matchState) => item is Exception; | |
| 71 } | |
| 72 | |
| 73 /// A matcher for FallThroughError. | |
| 74 @deprecated | |
| 75 const Matcher isFallThroughError = const _FallThroughError(); | |
| 76 | |
| 77 /// A matcher for functions that throw FallThroughError. | |
| 78 @deprecated | |
| 79 const Matcher throwsFallThroughError = const Throws(isFallThroughError); | |
| 80 | |
| 81 class _FallThroughError extends TypeMatcher { | |
| 82 const _FallThroughError(): super("FallThroughError"); | |
| 83 bool matches(item, Map matchState) => item is FallThroughError; | |
| 84 } | |
| 85 | |
| 86 /// A matcher for FormatExceptions. | |
| 87 const Matcher isFormatException = const _FormatException(); | |
| 88 | |
| 89 /// A matcher for functions that throw FormatException. | |
| 90 const Matcher throwsFormatException = const Throws(isFormatException); | |
| 91 | |
| 92 class _FormatException extends TypeMatcher { | |
| 93 const _FormatException(): super("FormatException"); | |
| 94 bool matches(item, Map matchState) => item is FormatException; | |
| 95 } | |
| 96 | |
| 97 /// A matcher for NoSuchMethodErrors. | |
| 98 const Matcher isNoSuchMethodError = const _NoSuchMethodError(); | |
| 99 | |
| 100 /// A matcher for functions that throw NoSuchMethodError. | |
| 101 const Matcher throwsNoSuchMethodError = const Throws(isNoSuchMethodError); | |
| 102 | |
| 103 class _NoSuchMethodError extends TypeMatcher { | |
| 104 const _NoSuchMethodError(): super("NoSuchMethodError"); | |
| 105 bool matches(item, Map matchState) => item is NoSuchMethodError; | |
| 106 } | |
| 107 | |
| 108 /// A matcher for NullThrownError. | |
| 109 const Matcher isNullThrownError = const _NullThrownError(); | |
| 110 | |
| 111 /// A matcher for functions that throw NullThrownError. | |
| 112 const Matcher throwsNullThrownError = const Throws(isNullThrownError); | |
| 113 | |
| 114 class _NullThrownError extends TypeMatcher { | |
| 115 const _NullThrownError(): super("NullThrownError"); | |
| 116 bool matches(item, Map matchState) => item is NullThrownError; | |
| 117 } | |
| 118 | |
| 119 /// A matcher for RangeErrors. | |
| 120 const Matcher isRangeError = const _RangeError(); | |
| 121 | |
| 122 /// A matcher for functions that throw RangeError. | |
| 123 const Matcher throwsRangeError = const Throws(isRangeError); | |
| 124 | |
| 125 class _RangeError extends TypeMatcher { | |
| 126 const _RangeError(): super("RangeError"); | |
| 127 bool matches(item, Map matchState) => item is RangeError; | |
| 128 } | |
| 129 | |
| 130 /// A matcher for StateErrors. | |
| 131 const Matcher isStateError = const _StateError(); | |
| 132 | |
| 133 /// A matcher for functions that throw StateError. | |
| 134 const Matcher throwsStateError = const Throws(isStateError); | |
| 135 | |
| 136 class _StateError extends TypeMatcher { | |
| 137 const _StateError(): super("StateError"); | |
| 138 bool matches(item, Map matchState) => item is StateError; | |
| 139 } | |
| 140 | |
| 141 /// A matcher for UnimplementedErrors. | |
| 142 const Matcher isUnimplementedError = const _UnimplementedError(); | |
| 143 | |
| 144 /// A matcher for functions that throw Exception. | |
| 145 const Matcher throwsUnimplementedError = const Throws(isUnimplementedError); | |
| 146 | |
| 147 class _UnimplementedError extends TypeMatcher { | |
| 148 const _UnimplementedError(): super("UnimplementedError"); | |
| 149 bool matches(item, Map matchState) => item is UnimplementedError; | |
| 150 } | |
| 151 | |
| 152 /// A matcher for UnsupportedError. | |
| 153 const Matcher isUnsupportedError = const _UnsupportedError(); | |
| 154 | |
| 155 /// A matcher for functions that throw UnsupportedError. | |
| 156 const Matcher throwsUnsupportedError = const Throws(isUnsupportedError); | |
| 157 | |
| 158 class _UnsupportedError extends TypeMatcher { | |
| 159 const _UnsupportedError(): super("UnsupportedError"); | |
| 160 bool matches(item, Map matchState) => item is UnsupportedError; | |
| 161 } | |
| OLD | NEW |