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 | 5 |
6 /** | 6 /** |
7 * Returns a matcher that matches empty strings, maps or collections. | 7 * Returns a matcher that matches empty strings, maps or collections. |
8 */ | 8 */ |
9 final Matcher isEmpty = const _Empty(); | 9 final Matcher isEmpty = const _Empty(); |
10 | 10 |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 * for each exception type. | 393 * for each exception type. |
394 */ | 394 */ |
395 | 395 |
396 /* abstract */ class _ExceptionMatcher extends BaseMatcher { | 396 /* abstract */ class _ExceptionMatcher extends BaseMatcher { |
397 final String _name; | 397 final String _name; |
398 const _ExceptionMatcher(this._name); | 398 const _ExceptionMatcher(this._name); |
399 Description describe(Description description) => | 399 Description describe(Description description) => |
400 description.add(_name); | 400 description.add(_name); |
401 } | 401 } |
402 | 402 |
403 /** A matcher for BadNumberFormatExceptions. */ | 403 /** A matcher for FormatExceptions. */ |
404 final isBadNumberFormatException = const _BadNumberFormatException(); | 404 final isFormatException = const _FormatException(); |
405 | 405 |
406 /** A matcher for functions that throw BadNumberFormatException */ | 406 /** A matcher for functions that throw FormatException */ |
407 final Matcher throwsBadNumberFormatException = | 407 final Matcher throwsFormatException = |
408 const _Throws(isBadNumberFormatException); | 408 const _Throws(isFormatException); |
409 | 409 |
410 class _BadNumberFormatException extends _ExceptionMatcher { | 410 class _FormatException extends _ExceptionMatcher { |
411 const _BadNumberFormatException() : super("BadNumberFormatException"); | 411 const _FormatException() : super("FormatException"); |
412 bool matches(item, MatchState matchState) => item is BadNumberFormatException; | 412 bool matches(item, MatchState matchState) => item is FormatException; |
413 } | 413 } |
414 | 414 |
415 /** A matcher for Exceptions. */ | 415 /** A matcher for Exceptions. */ |
416 final isException = const _Exception(); | 416 final isException = const _Exception(); |
417 | 417 |
418 /** A matcher for functions that throw Exception */ | 418 /** A matcher for functions that throw Exception */ |
419 final Matcher throwsException = const _Throws(isException); | 419 final Matcher throwsException = const _Throws(isException); |
420 | 420 |
421 class _Exception extends _ExceptionMatcher { | 421 class _Exception extends _ExceptionMatcher { |
422 const _Exception() : super("Exception"); | 422 const _Exception() : super("Exception"); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 final _matcher; | 617 final _matcher; |
618 final String _description; | 618 final String _description; |
619 | 619 |
620 const _Predicate(this._matcher, this._description); | 620 const _Predicate(this._matcher, this._description); |
621 | 621 |
622 bool matches(item, MatchState matchState) => _matcher(item); | 622 bool matches(item, MatchState matchState) => _matcher(item); |
623 | 623 |
624 Description describe(Description description) => | 624 Description describe(Description description) => |
625 description.add(_description); | 625 description.add(_description); |
626 } | 626 } |
OLD | NEW |