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