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