Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1205)

Side by Side Diff: pkg/matcher/lib/src/error_matchers.dart

Issue 317733006: pkg/matcher: reapply 36881,36896 working around Issue 19173 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: nit Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/matcher/lib/src/description.dart ('k') | pkg/matcher/lib/src/expect.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 /// **DEPRECATED**
11 ///
12 /// Will be removed in the next major release.
13 // TODO(kevmoo): re-deprecate once 19173 is resolved
14 //@deprecated
15 const Matcher isAbstractClassInstantiationError =
16 const _AbstractClassInstantiationError();
17
18 /// **DEPRECATED**
19 ///
20 /// Will be removed in the next major release.
21 // TODO(kevmoo): re-deprecate once 19173 is resolved
22 //@deprecated
23 const Matcher throwsAbstractClassInstantiationError =
24 const Throws(isAbstractClassInstantiationError);
25
26 class _AbstractClassInstantiationError extends TypeMatcher {
27 const _AbstractClassInstantiationError() :
28 super("AbstractClassInstantiationError");
29 bool matches(item, Map matchState) => item is AbstractClassInstantiationError;
30 }
31
32 /// A matcher for ArgumentErrors.
33 const Matcher isArgumentError = const _ArgumentError();
34
35 /// A matcher for functions that throw ArgumentError.
36 const Matcher throwsArgumentError = const Throws(isArgumentError);
37
38 class _ArgumentError extends TypeMatcher {
39 const _ArgumentError(): super("ArgumentError");
40 bool matches(item, Map matchState) => item is ArgumentError;
41 }
42
43 /// A matcher for ConcurrentModificationError.
44 const Matcher isConcurrentModificationError =
45 const _ConcurrentModificationError();
46
47 /// A matcher for functions that throw ConcurrentModificationError.
48 const Matcher throwsConcurrentModificationError =
49 const Throws(isConcurrentModificationError);
50
51 class _ConcurrentModificationError extends TypeMatcher {
52 const _ConcurrentModificationError(): super("ConcurrentModificationError");
53 bool matches(item, Map matchState) => item is ConcurrentModificationError;
54 }
55
56 /// A matcher for CyclicInitializationError.
57 const Matcher isCyclicInitializationError = const _CyclicInitializationError();
58
59 /// A matcher for functions that throw CyclicInitializationError.
60 const Matcher throwsCyclicInitializationError =
61 const Throws(isCyclicInitializationError);
62
63 class _CyclicInitializationError extends TypeMatcher {
64 const _CyclicInitializationError(): super("CyclicInitializationError");
65 bool matches(item, Map matchState) => item is CyclicInitializationError;
66 }
67
68 /// A matcher for Exceptions.
69 const Matcher isException = const _Exception();
70
71 /// A matcher for functions that throw Exception.
72 const Matcher throwsException = const Throws(isException);
73
74 class _Exception extends TypeMatcher {
75 const _Exception(): super("Exception");
76 bool matches(item, Map matchState) => item is Exception;
77 }
78
79 /// **DEPRECATED**
80 ///
81 /// Will be removed in the next major release.
82 // TODO(kevmoo): re-deprecate once 19173 is resolved
83 //@deprecated
84 const Matcher isFallThroughError = const _FallThroughError();
85
86 /// **DEPRECATED**
87 ///
88 /// Will be removed in the next major release.
89 // TODO(kevmoo): re-deprecate once 19173 is resolved
90 //@deprecated
91 const Matcher throwsFallThroughError = const Throws(isFallThroughError);
92
93 class _FallThroughError extends TypeMatcher {
94 const _FallThroughError(): super("FallThroughError");
95 bool matches(item, Map matchState) => item is FallThroughError;
96 }
97
98 /// A matcher for FormatExceptions.
99 const Matcher isFormatException = const _FormatException();
100
101 /// A matcher for functions that throw FormatException.
102 const Matcher throwsFormatException = const Throws(isFormatException);
103
104 class _FormatException extends TypeMatcher {
105 const _FormatException(): super("FormatException");
106 bool matches(item, Map matchState) => item is FormatException;
107 }
108
109 /// A matcher for NoSuchMethodErrors.
110 const Matcher isNoSuchMethodError = const _NoSuchMethodError();
111
112 /// A matcher for functions that throw NoSuchMethodError.
113 const Matcher throwsNoSuchMethodError = const Throws(isNoSuchMethodError);
114
115 class _NoSuchMethodError extends TypeMatcher {
116 const _NoSuchMethodError(): super("NoSuchMethodError");
117 bool matches(item, Map matchState) => item is NoSuchMethodError;
118 }
119
120 /// A matcher for NullThrownError.
121 const Matcher isNullThrownError = const _NullThrownError();
122
123 /// A matcher for functions that throw NullThrownError.
124 const Matcher throwsNullThrownError = const Throws(isNullThrownError);
125
126 class _NullThrownError extends TypeMatcher {
127 const _NullThrownError(): super("NullThrownError");
128 bool matches(item, Map matchState) => item is NullThrownError;
129 }
130
131 /// A matcher for RangeErrors.
132 const Matcher isRangeError = const _RangeError();
133
134 /// A matcher for functions that throw RangeError.
135 const Matcher throwsRangeError = const Throws(isRangeError);
136
137 class _RangeError extends TypeMatcher {
138 const _RangeError(): super("RangeError");
139 bool matches(item, Map matchState) => item is RangeError;
140 }
141
142 /// A matcher for StateErrors.
143 const Matcher isStateError = const _StateError();
144
145 /// A matcher for functions that throw StateError.
146 const Matcher throwsStateError = const Throws(isStateError);
147
148 class _StateError extends TypeMatcher {
149 const _StateError(): super("StateError");
150 bool matches(item, Map matchState) => item is StateError;
151 }
152
153 /// A matcher for UnimplementedErrors.
154 const Matcher isUnimplementedError = const _UnimplementedError();
155
156 /// A matcher for functions that throw Exception.
157 const Matcher throwsUnimplementedError = const Throws(isUnimplementedError);
158
159 class _UnimplementedError extends TypeMatcher {
160 const _UnimplementedError(): super("UnimplementedError");
161 bool matches(item, Map matchState) => item is UnimplementedError;
162 }
163
164 /// A matcher for UnsupportedError.
165 const Matcher isUnsupportedError = const _UnsupportedError();
166
167 /// A matcher for functions that throw UnsupportedError.
168 const Matcher throwsUnsupportedError = const Throws(isUnsupportedError);
169
170 class _UnsupportedError extends TypeMatcher {
171 const _UnsupportedError(): super("UnsupportedError");
172 bool matches(item, Map matchState) => item is UnsupportedError;
173 }
OLDNEW
« no previous file with comments | « pkg/matcher/lib/src/description.dart ('k') | pkg/matcher/lib/src/expect.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698