@@ -21,8 +21,7 @@ class _Empty extends Matcher {
21
21
return false ;
22
22
}
23
23
}
24
- Description describe (Description description) =>
25
- description.add ('empty' );
24
+ Description describe (Description description) => description.add ('empty' );
26
25
}
27
26
28
27
/** A matcher that matches any null value. */
@@ -34,15 +33,13 @@ const Matcher isNotNull = const _IsNotNull();
34
33
class _IsNull extends Matcher {
35
34
const _IsNull ();
36
35
bool matches (item, Map matchState) => item == null ;
37
- Description describe (Description description) =>
38
- description.add ('null' );
36
+ Description describe (Description description) => description.add ('null' );
39
37
}
40
38
41
39
class _IsNotNull extends Matcher {
42
40
const _IsNotNull ();
43
41
bool matches (item, Map matchState) => item != null ;
44
- Description describe (Description description) =>
45
- description.add ('not null' );
42
+ Description describe (Description description) => description.add ('not null' );
46
43
}
47
44
48
45
/** A matcher that matches the Boolean value true. */
@@ -54,15 +51,13 @@ const Matcher isFalse = const _IsFalse();
54
51
class _IsTrue extends Matcher {
55
52
const _IsTrue ();
56
53
bool matches (item, Map matchState) => item == true ;
57
- Description describe (Description description) =>
58
- description.add ('true' );
54
+ Description describe (Description description) => description.add ('true' );
59
55
}
60
56
61
57
class _IsFalse extends Matcher {
62
58
const _IsFalse ();
63
59
bool matches (item, Map matchState) => item == false ;
64
- Description describe (Description description) =>
65
- description.add ('false' );
60
+ Description describe (Description description) => description.add ('false' );
66
61
}
67
62
68
63
/**
@@ -101,15 +96,15 @@ class _DeepMatcher extends Matcher {
101
96
final int _limit;
102
97
var count;
103
98
104
- _DeepMatcher (this ._expected, [limit = 1000 ]) : this ._limit = limit;
99
+ _DeepMatcher (this ._expected, [limit = 1000 ]): this ._limit = limit;
105
100
106
101
// Returns a pair (reason, location)
107
102
List _compareIterables (expected, actual, matcher, depth, location) {
108
103
if (actual is ! Iterable ) return ['is not Iterable' , location];
109
104
110
105
var expectedIterator = expected.iterator;
111
106
var actualIterator = actual.iterator;
112
- for (var index = 0 ;; index++ ) {
107
+ for (var index = 0 ; ; index++ ) {
113
108
// Advance in lockstep.
114
109
var expectedNext = expectedIterator.moveNext ();
115
110
var actualNext = actualIterator.moveNext ();
@@ -324,8 +319,7 @@ const Matcher anything = const _IsAnything();
324
319
class _IsAnything extends Matcher {
325
320
const _IsAnything ();
326
321
bool matches (item, Map matchState) => true ;
327
- Description describe (Description description) =>
328
- description.add ('anything' );
322
+ Description describe (Description description) => description.add ('anything' );
329
323
}
330
324
331
325
/**
@@ -352,7 +346,7 @@ class _IsAnything extends Matcher {
352
346
*/
353
347
class isInstanceOf< T > extends Matcher {
354
348
final String _name;
355
- const isInstanceOf ([name = 'specified type' ]) : this ._name = name;
349
+ const isInstanceOf ([name = 'specified type' ]): this ._name = name;
356
350
bool matches (obj, Map matchState) => obj is T ;
357
351
// The description here is lame :-(
358
352
Description describe (Description description) =>
@@ -405,8 +399,7 @@ const Matcher returnsNormally = const _ReturnsNormally();
405
399
class Throws extends Matcher {
406
400
final Matcher _matcher;
407
401
408
- const Throws ([Matcher matcher]) :
409
- this ._matcher = matcher;
402
+ const Throws ([Matcher matcher]): this ._matcher = matcher;
410
403
411
404
bool matches (item, Map matchState) {
412
405
if (item is ! Function && item is ! Future ) return false ;
@@ -523,19 +516,17 @@ class _ReturnsNormally extends Matcher {
523
516
abstract class TypeMatcher extends Matcher {
524
517
final String _name;
525
518
const TypeMatcher (this ._name);
526
- Description describe (Description description) =>
527
- description.add (_name);
519
+ Description describe (Description description) => description.add (_name);
528
520
}
529
521
530
522
/** A matcher for FormatExceptions. */
531
523
const isFormatException = const _FormatException ();
532
524
533
525
/** A matcher for functions that throw FormatException. */
534
- const Matcher throwsFormatException =
535
- const Throws (isFormatException);
526
+ const Matcher throwsFormatException = const Throws (isFormatException);
536
527
537
528
class _FormatException extends TypeMatcher {
538
- const _FormatException () : super ("FormatException" );
529
+ const _FormatException (): super ("FormatException" );
539
530
bool matches (item, Map matchState) => item is FormatException ;
540
531
}
541
532
@@ -546,55 +537,51 @@ const isException = const _Exception();
546
537
const Matcher throwsException = const Throws (isException);
547
538
548
539
class _Exception extends TypeMatcher {
549
- const _Exception () : super ("Exception" );
540
+ const _Exception (): super ("Exception" );
550
541
bool matches (item, Map matchState) => item is Exception ;
551
542
}
552
543
553
544
/** A matcher for ArgumentErrors. */
554
545
const isArgumentError = const _ArgumentError ();
555
546
556
547
/** A matcher for functions that throw ArgumentError. */
557
- const Matcher throwsArgumentError =
558
- const Throws (isArgumentError);
548
+ const Matcher throwsArgumentError = const Throws (isArgumentError);
559
549
560
550
class _ArgumentError extends TypeMatcher {
561
- const _ArgumentError () : super ("ArgumentError" );
551
+ const _ArgumentError (): super ("ArgumentError" );
562
552
bool matches (item, Map matchState) => item is ArgumentError ;
563
553
}
564
554
565
555
/** A matcher for RangeErrors. */
566
556
const isRangeError = const _RangeError ();
567
557
568
558
/** A matcher for functions that throw RangeError. */
569
- const Matcher throwsRangeError =
570
- const Throws (isRangeError);
559
+ const Matcher throwsRangeError = const Throws (isRangeError);
571
560
572
561
class _RangeError extends TypeMatcher {
573
- const _RangeError () : super ("RangeError" );
562
+ const _RangeError (): super ("RangeError" );
574
563
bool matches (item, Map matchState) => item is RangeError ;
575
564
}
576
565
577
566
/** A matcher for NoSuchMethodErrors. */
578
567
const isNoSuchMethodError = const _NoSuchMethodError ();
579
568
580
569
/** A matcher for functions that throw NoSuchMethodError. */
581
- const Matcher throwsNoSuchMethodError =
582
- const Throws (isNoSuchMethodError);
570
+ const Matcher throwsNoSuchMethodError = const Throws (isNoSuchMethodError);
583
571
584
572
class _NoSuchMethodError extends TypeMatcher {
585
- const _NoSuchMethodError () : super ("NoSuchMethodError" );
573
+ const _NoSuchMethodError (): super ("NoSuchMethodError" );
586
574
bool matches (item, Map matchState) => item is NoSuchMethodError ;
587
575
}
588
576
589
577
/** A matcher for UnimplementedErrors. */
590
578
const isUnimplementedError = const _UnimplementedError ();
591
579
592
580
/** A matcher for functions that throw Exception. */
593
- const Matcher throwsUnimplementedError =
594
- const Throws (isUnimplementedError);
581
+ const Matcher throwsUnimplementedError = const Throws (isUnimplementedError);
595
582
596
583
class _UnimplementedError extends TypeMatcher {
597
- const _UnimplementedError () : super ("UnimplementedError" );
584
+ const _UnimplementedError (): super ("UnimplementedError" );
598
585
bool matches (item, Map matchState) => item is UnimplementedError ;
599
586
}
600
587
@@ -605,44 +592,40 @@ const isUnsupportedError = const _UnsupportedError();
605
592
const Matcher throwsUnsupportedError = const Throws (isUnsupportedError);
606
593
607
594
class _UnsupportedError extends TypeMatcher {
608
- const _UnsupportedError () :
609
- super ("UnsupportedError" );
595
+ const _UnsupportedError (): super ("UnsupportedError" );
610
596
bool matches (item, Map matchState) => item is UnsupportedError ;
611
597
}
612
598
613
599
/** A matcher for StateErrors. */
614
600
const isStateError = const _StateError ();
615
601
616
602
/** A matcher for functions that throw StateError. */
617
- const Matcher throwsStateError =
618
- const Throws (isStateError);
603
+ const Matcher throwsStateError = const Throws (isStateError);
619
604
620
605
class _StateError extends TypeMatcher {
621
- const _StateError () : super ("StateError" );
606
+ const _StateError (): super ("StateError" );
622
607
bool matches (item, Map matchState) => item is StateError ;
623
608
}
624
609
625
610
/** A matcher for FallThroughError. */
626
611
const isFallThroughError = const _FallThroughError ();
627
612
628
613
/** A matcher for functions that throw FallThroughError. */
629
- const Matcher throwsFallThroughError =
630
- const Throws (isFallThroughError);
614
+ const Matcher throwsFallThroughError = const Throws (isFallThroughError);
631
615
632
616
class _FallThroughError extends TypeMatcher {
633
- const _FallThroughError () : super ("FallThroughError" );
617
+ const _FallThroughError (): super ("FallThroughError" );
634
618
bool matches (item, Map matchState) => item is FallThroughError ;
635
619
}
636
620
637
621
/** A matcher for NullThrownError. */
638
622
const isNullThrownError = const _NullThrownError ();
639
623
640
624
/** A matcher for functions that throw NullThrownError. */
641
- const Matcher throwsNullThrownError =
642
- const Throws (isNullThrownError);
625
+ const Matcher throwsNullThrownError = const Throws (isNullThrownError);
643
626
644
627
class _NullThrownError extends TypeMatcher {
645
- const _NullThrownError () : super ("NullThrownError" );
628
+ const _NullThrownError (): super ("NullThrownError" );
646
629
bool matches (item, Map matchState) => item is NullThrownError ;
647
630
}
648
631
@@ -654,7 +637,7 @@ const Matcher throwsConcurrentModificationError =
654
637
const Throws (isConcurrentModificationError);
655
638
656
639
class _ConcurrentModificationError extends TypeMatcher {
657
- const _ConcurrentModificationError () : super ("ConcurrentModificationError" );
640
+ const _ConcurrentModificationError (): super ("ConcurrentModificationError" );
658
641
bool matches (item, Map matchState) => item is ConcurrentModificationError ;
659
642
}
660
643
@@ -680,36 +663,35 @@ const Matcher throwsCyclicInitializationError =
680
663
const Throws (isCyclicInitializationError);
681
664
682
665
class _CyclicInitializationError extends TypeMatcher {
683
- const _CyclicInitializationError () : super ("CyclicInitializationError" );
666
+ const _CyclicInitializationError (): super ("CyclicInitializationError" );
684
667
bool matches (item, Map matchState) => item is CyclicInitializationError ;
685
668
}
686
669
687
670
/** A matcher for Map types. */
688
671
const isMap = const _IsMap ();
689
672
690
673
class _IsMap extends TypeMatcher {
691
- const _IsMap () : super ("Map" );
674
+ const _IsMap (): super ("Map" );
692
675
bool matches (item, Map matchState) => item is Map ;
693
676
}
694
677
695
678
/** A matcher for List types. */
696
679
const isList = const _IsList ();
697
680
698
681
class _IsList extends TypeMatcher {
699
- const _IsList () : super ("List" );
682
+ const _IsList (): super ("List" );
700
683
bool matches (item, Map matchState) => item is List ;
701
684
}
702
685
703
686
/**
704
687
* Returns a matcher that matches if an object has a length property
705
688
* that matches [matcher] .
706
689
*/
707
- Matcher hasLength (matcher) =>
708
- new _HasLength (wrapMatcher (matcher));
690
+ Matcher hasLength (matcher) => new _HasLength (wrapMatcher (matcher));
709
691
710
692
class _HasLength extends Matcher {
711
693
final Matcher _matcher;
712
- const _HasLength ([Matcher matcher = null ]) : this ._matcher = matcher;
694
+ const _HasLength ([Matcher matcher = null ]): this ._matcher = matcher;
713
695
714
696
bool matches (item, Map matchState) {
715
697
try {
@@ -820,7 +802,7 @@ class _In extends Matcher {
820
802
*
821
803
* expect(v, predicate((x) => ((x % 2) == 0), "is even"))
822
804
*/
823
- Matcher predicate (Function f, [description = 'satisfies function' ]) =>
805
+ Matcher predicate (Function f, [description = 'satisfies function' ]) =>
824
806
new _Predicate (f, description);
825
807
826
808
class _Predicate extends Matcher {
0 commit comments