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 ArgumentErrors. | 10 /// A matcher for ArgumentErrors. |
11 const Matcher isArgumentError = const _ArgumentError(); | 11 const Matcher isArgumentError = const _ArgumentError(); |
12 | 12 |
13 class _ArgumentError extends TypeMatcher { | 13 class _ArgumentError extends TypeMatcher { |
14 const _ArgumentError(): super("ArgumentError"); | 14 const _ArgumentError() : super("ArgumentError"); |
15 bool matches(item, Map matchState) => item is ArgumentError; | 15 bool matches(item, Map matchState) => item is ArgumentError; |
16 } | 16 } |
17 | 17 |
18 /// A matcher for ConcurrentModificationError. | 18 /// A matcher for ConcurrentModificationError. |
19 const Matcher isConcurrentModificationError = | 19 const Matcher isConcurrentModificationError = |
20 const _ConcurrentModificationError(); | 20 const _ConcurrentModificationError(); |
21 | 21 |
22 class _ConcurrentModificationError extends TypeMatcher { | 22 class _ConcurrentModificationError extends TypeMatcher { |
23 const _ConcurrentModificationError(): super("ConcurrentModificationError"); | 23 const _ConcurrentModificationError() : super("ConcurrentModificationError"); |
24 bool matches(item, Map matchState) => item is ConcurrentModificationError; | 24 bool matches(item, Map matchState) => item is ConcurrentModificationError; |
25 } | 25 } |
26 | 26 |
27 /// A matcher for CyclicInitializationError. | 27 /// A matcher for CyclicInitializationError. |
28 const Matcher isCyclicInitializationError = const _CyclicInitializationError(); | 28 const Matcher isCyclicInitializationError = const _CyclicInitializationError(); |
29 | 29 |
30 class _CyclicInitializationError extends TypeMatcher { | 30 class _CyclicInitializationError extends TypeMatcher { |
31 const _CyclicInitializationError(): super("CyclicInitializationError"); | 31 const _CyclicInitializationError() : super("CyclicInitializationError"); |
32 bool matches(item, Map matchState) => item is CyclicInitializationError; | 32 bool matches(item, Map matchState) => item is CyclicInitializationError; |
33 } | 33 } |
34 | 34 |
35 /// A matcher for Exceptions. | 35 /// A matcher for Exceptions. |
36 const Matcher isException = const _Exception(); | 36 const Matcher isException = const _Exception(); |
37 | 37 |
38 class _Exception extends TypeMatcher { | 38 class _Exception extends TypeMatcher { |
39 const _Exception(): super("Exception"); | 39 const _Exception() : super("Exception"); |
40 bool matches(item, Map matchState) => item is Exception; | 40 bool matches(item, Map matchState) => item is Exception; |
41 } | 41 } |
42 | 42 |
43 class _FallThroughError extends TypeMatcher { | |
44 const _FallThroughError(): super("FallThroughError"); | |
45 bool matches(item, Map matchState) => item is FallThroughError; | |
46 } | |
47 | |
48 /// A matcher for FormatExceptions. | 43 /// A matcher for FormatExceptions. |
49 const Matcher isFormatException = const _FormatException(); | 44 const Matcher isFormatException = const _FormatException(); |
50 | 45 |
51 class _FormatException extends TypeMatcher { | 46 class _FormatException extends TypeMatcher { |
52 const _FormatException(): super("FormatException"); | 47 const _FormatException() : super("FormatException"); |
53 bool matches(item, Map matchState) => item is FormatException; | 48 bool matches(item, Map matchState) => item is FormatException; |
54 } | 49 } |
55 | 50 |
56 /// A matcher for NoSuchMethodErrors. | 51 /// A matcher for NoSuchMethodErrors. |
57 const Matcher isNoSuchMethodError = const _NoSuchMethodError(); | 52 const Matcher isNoSuchMethodError = const _NoSuchMethodError(); |
58 | 53 |
59 class _NoSuchMethodError extends TypeMatcher { | 54 class _NoSuchMethodError extends TypeMatcher { |
60 const _NoSuchMethodError(): super("NoSuchMethodError"); | 55 const _NoSuchMethodError() : super("NoSuchMethodError"); |
61 bool matches(item, Map matchState) => item is NoSuchMethodError; | 56 bool matches(item, Map matchState) => item is NoSuchMethodError; |
62 } | 57 } |
63 | 58 |
64 /// A matcher for NullThrownError. | 59 /// A matcher for NullThrownError. |
65 const Matcher isNullThrownError = const _NullThrownError(); | 60 const Matcher isNullThrownError = const _NullThrownError(); |
66 | 61 |
67 class _NullThrownError extends TypeMatcher { | 62 class _NullThrownError extends TypeMatcher { |
68 const _NullThrownError(): super("NullThrownError"); | 63 const _NullThrownError() : super("NullThrownError"); |
69 bool matches(item, Map matchState) => item is NullThrownError; | 64 bool matches(item, Map matchState) => item is NullThrownError; |
70 } | 65 } |
71 | 66 |
72 /// A matcher for RangeErrors. | 67 /// A matcher for RangeErrors. |
73 const Matcher isRangeError = const _RangeError(); | 68 const Matcher isRangeError = const _RangeError(); |
74 | 69 |
75 class _RangeError extends TypeMatcher { | 70 class _RangeError extends TypeMatcher { |
76 const _RangeError(): super("RangeError"); | 71 const _RangeError() : super("RangeError"); |
77 bool matches(item, Map matchState) => item is RangeError; | 72 bool matches(item, Map matchState) => item is RangeError; |
78 } | 73 } |
79 | 74 |
80 /// A matcher for StateErrors. | 75 /// A matcher for StateErrors. |
81 const Matcher isStateError = const _StateError(); | 76 const Matcher isStateError = const _StateError(); |
82 | 77 |
83 class _StateError extends TypeMatcher { | 78 class _StateError extends TypeMatcher { |
84 const _StateError(): super("StateError"); | 79 const _StateError() : super("StateError"); |
85 bool matches(item, Map matchState) => item is StateError; | 80 bool matches(item, Map matchState) => item is StateError; |
86 } | 81 } |
87 | 82 |
88 /// A matcher for UnimplementedErrors. | 83 /// A matcher for UnimplementedErrors. |
89 const Matcher isUnimplementedError = const _UnimplementedError(); | 84 const Matcher isUnimplementedError = const _UnimplementedError(); |
90 | 85 |
91 class _UnimplementedError extends TypeMatcher { | 86 class _UnimplementedError extends TypeMatcher { |
92 const _UnimplementedError(): super("UnimplementedError"); | 87 const _UnimplementedError() : super("UnimplementedError"); |
93 bool matches(item, Map matchState) => item is UnimplementedError; | 88 bool matches(item, Map matchState) => item is UnimplementedError; |
94 } | 89 } |
95 | 90 |
96 /// A matcher for UnsupportedError. | 91 /// A matcher for UnsupportedError. |
97 const Matcher isUnsupportedError = const _UnsupportedError(); | 92 const Matcher isUnsupportedError = const _UnsupportedError(); |
98 | 93 |
99 class _UnsupportedError extends TypeMatcher { | 94 class _UnsupportedError extends TypeMatcher { |
100 const _UnsupportedError(): super("UnsupportedError"); | 95 const _UnsupportedError() : super("UnsupportedError"); |
101 bool matches(item, Map matchState) => item is UnsupportedError; | 96 bool matches(item, Map matchState) => item is UnsupportedError; |
102 } | 97 } |
OLD | NEW |