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 /// A matcher for FormatExceptions. |
| 44 const Matcher isFormatException = const _FormatException(); |
| 45 |
| 46 class _FormatException extends TypeMatcher { |
| 47 const _FormatException() : super("FormatException"); |
| 48 bool matches(item, Map matchState) => item is FormatException; |
| 49 } |
| 50 |
| 51 /// A matcher for NoSuchMethodErrors. |
| 52 const Matcher isNoSuchMethodError = const _NoSuchMethodError(); |
| 53 |
| 54 class _NoSuchMethodError extends TypeMatcher { |
| 55 const _NoSuchMethodError() : super("NoSuchMethodError"); |
| 56 bool matches(item, Map matchState) => item is NoSuchMethodError; |
| 57 } |
| 58 |
| 59 /// A matcher for NullThrownError. |
| 60 const Matcher isNullThrownError = const _NullThrownError(); |
| 61 |
| 62 class _NullThrownError extends TypeMatcher { |
| 63 const _NullThrownError() : super("NullThrownError"); |
| 64 bool matches(item, Map matchState) => item is NullThrownError; |
| 65 } |
| 66 |
| 67 /// A matcher for RangeErrors. |
| 68 const Matcher isRangeError = const _RangeError(); |
| 69 |
| 70 class _RangeError extends TypeMatcher { |
| 71 const _RangeError() : super("RangeError"); |
| 72 bool matches(item, Map matchState) => item is RangeError; |
| 73 } |
| 74 |
| 75 /// A matcher for StateErrors. |
| 76 const Matcher isStateError = const _StateError(); |
| 77 |
| 78 class _StateError extends TypeMatcher { |
| 79 const _StateError() : super("StateError"); |
| 80 bool matches(item, Map matchState) => item is StateError; |
| 81 } |
| 82 |
| 83 /// A matcher for UnimplementedErrors. |
| 84 const Matcher isUnimplementedError = const _UnimplementedError(); |
| 85 |
| 86 class _UnimplementedError extends TypeMatcher { |
| 87 const _UnimplementedError() : super("UnimplementedError"); |
| 88 bool matches(item, Map matchState) => item is UnimplementedError; |
| 89 } |
| 90 |
| 91 /// A matcher for UnsupportedError. |
| 92 const Matcher isUnsupportedError = const _UnsupportedError(); |
| 93 |
| 94 class _UnsupportedError extends TypeMatcher { |
| 95 const _UnsupportedError() : super("UnsupportedError"); |
| 96 bool matches(item, Map matchState) => item is UnsupportedError; |
| 97 } |
OLD | NEW |