@@ -722,13 +722,11 @@ void main() {
722
722
});
723
723
test ('can invoke a tool multiple times in one comment block' , () {
724
724
var envLine = RegExp (r'^Env: \{' , multiLine: true );
725
- expect (
726
- envLine.allMatches (invokeToolMultipleSections.documentation).length,
727
- equals (2 ));
725
+ expect (envLine.allMatches (invokeToolMultipleSections.documentation),
726
+ hasLength (2 ));
728
727
var argLine = RegExp (r'^Args: \[' , multiLine: true );
729
- expect (
730
- argLine.allMatches (invokeToolMultipleSections.documentation).length,
731
- equals (2 ));
728
+ expect (argLine.allMatches (invokeToolMultipleSections.documentation),
729
+ hasLength (2 ));
732
730
expect (invokeToolMultipleSections.documentation,
733
731
contains ('Invokes more than one tool in the same comment block.' ));
734
732
expect (invokeToolMultipleSections.documentation,
@@ -760,13 +758,12 @@ void main() {
760
758
761
759
group ('Category' , () {
762
760
test ('Verify categories for test_package' , () {
763
- expect (packageGraph.localPackages.length, equals (1 ));
761
+ expect (packageGraph.localPackages, hasLength (1 ));
764
762
expect (packageGraph.localPackages.first.hasCategories, isTrue);
765
763
var packageCategories = packageGraph.localPackages.first.categories;
766
- expect (packageCategories.length, equals (6 ));
767
- expect (
768
- packageGraph.localPackages.first.categoriesWithPublicLibraries.length,
769
- equals (3 ));
764
+ expect (packageCategories, hasLength (6 ));
765
+ expect (packageGraph.localPackages.first.categoriesWithPublicLibraries,
766
+ hasLength (3 ));
770
767
expect (
771
768
packageCategories.map ((c) => c.name).toList (),
772
769
orderedEquals ([
@@ -777,8 +774,16 @@ void main() {
777
774
'More Excellence' ,
778
775
'NotSoExcellent'
779
776
]));
780
- expect (packageCategories.map ((c) => c.libraries.length).toList (),
781
- orderedEquals ([0 , 2 , 3 , 1 , 0 , 0 ]));
777
+ expect (
778
+ packageCategories.map ((c) => c.libraries).toList (),
779
+ orderedEquals ([
780
+ hasLength (0 ),
781
+ hasLength (2 ),
782
+ hasLength (3 ),
783
+ hasLength (1 ),
784
+ hasLength (0 ),
785
+ hasLength (0 )
786
+ ]));
782
787
});
783
788
784
789
test ('Verify libraries with multiple categories show up in multiple places' ,
@@ -1296,22 +1301,21 @@ void main() {
1296
1301
});
1297
1302
1298
1303
test ('Verify table appearance' , () {
1299
- expect (docsAsHtml.contains ('<table><thead><tr><th>Component</th>' ),
1300
- isTrue);
1304
+ expect (docsAsHtml, contains ('<table><thead><tr><th>Component</th>' ));
1301
1305
});
1302
1306
1303
1307
test ('Verify links inside of table headers' , () {
1304
1308
expect (
1305
- docsAsHtml. contains (
1306
- '<th><a href="${ htmlBasePlaceholder }fake/Annotation-class.html">Annotation</a></th>' ),
1307
- isTrue );
1309
+ docsAsHtml,
1310
+ contains (
1311
+ '<th><a href="${ htmlBasePlaceholder }fake/Annotation-class.html">Annotation</a></th>' ) );
1308
1312
});
1309
1313
1310
1314
test ('Verify links inside of table body' , () {
1311
1315
expect (
1312
- docsAsHtml. contains (
1313
- '<tbody><tr><td><a href="${ htmlBasePlaceholder }fake/DocumentWithATable/foo-constant.html">foo</a></td>' ),
1314
- isTrue );
1316
+ docsAsHtml,
1317
+ contains (
1318
+ '<tbody><tr><td><a href="${ htmlBasePlaceholder }fake/DocumentWithATable/foo-constant.html">foo</a></td>' ) );
1315
1319
});
1316
1320
1317
1321
test ('Verify there is no emoji support' , () {
@@ -1910,7 +1914,7 @@ void main() {
1910
1914
.map <String >((ElementType t) => t.name),
1911
1915
orderedEquals (['int' ]));
1912
1916
1913
- expect (TypeInferenceMixedIn .superChain.length, equals (2 ));
1917
+ expect (TypeInferenceMixedIn .superChain, hasLength (2 ));
1914
1918
final firstType =
1915
1919
TypeInferenceMixedIn .superChain.first as ParameterizedElementType ;
1916
1920
final lastType =
@@ -2143,8 +2147,8 @@ void main() {
2143
2147
test ('all instance methods' , () {
2144
2148
var methods = B .publicInstanceMethods.where ((m) => ! m.isInherited);
2145
2149
expect (methods, isNotEmpty);
2146
- expect (B .publicInstanceMethods.length ,
2147
- equals (methods.length + B .publicInheritedMethods.length));
2150
+ expect (B .publicInstanceMethods,
2151
+ hasLength (methods.length + B .publicInheritedMethods.length));
2148
2152
});
2149
2153
2150
2154
test ('inherited methods exist' , () {
@@ -3014,7 +3018,7 @@ void main() {
3014
3018
});
3015
3019
3016
3020
test ('static fields inside extensions do not crash' , () {
3017
- expect (staticFieldExtension.staticFields.length, equals (1 ));
3021
+ expect (staticFieldExtension.staticFields, hasLength (1 ));
3018
3022
expect (staticFieldExtension.staticFields.first.name, equals ('aStatic' ));
3019
3023
});
3020
3024
@@ -3125,7 +3129,7 @@ void main() {
3125
3129
'<a href="%%__HTMLBASE_dartdoc_internal__%%ex/AnExtendableThing-class.html">AnExtendableThing</a>' ));
3126
3130
// TODO(jcollins-g): consider linking via applied extensions?
3127
3131
expect (doSomeStuff.documentationAsHtml, contains ('<code>aMember</code>' ));
3128
- }, skip : 'unskip when enhanced lookups are on by default' );
3132
+ });
3129
3133
3130
3134
test (
3131
3135
'references from outside an extension refer correctly to the extension' ,
@@ -3458,10 +3462,10 @@ String? topLevelFunction(int param1, bool param2, Cool coolBeans,
3458
3462
params,
3459
3463
'<span class="parameter" id="doAComplicatedThing-param-x"><span class="type-annotation">int</span> <span class="parameter-name">x</span>, </span>'
3460
3464
'<span class="parameter" id="doAComplicatedThing-param-doSomething">{<span class="type-annotation">void</span> <span class="parameter-name">doSomething</span>(<span class="parameter" id="doSomething-param-aThingParameter"><span class="type-annotation">int</span> <span class="parameter-name">aThingParameter</span>, </span>'
3461
- '<span class="parameter" id="doSomething-param-anotherThing"><span class="type-annotation">String</span> <span class="parameter-name">anotherThing</span></span>), </span>'
3465
+ '<span class="parameter" id="doSomething-param-anotherThing"><span class="type-annotation">String</span> <span class="parameter-name">anotherThing</span></span>)? , </span>'
3462
3466
'<span class="parameter" id="doAComplicatedThing-param-doSomethingElse"><span class="type-annotation">void</span> <span class="parameter-name">doSomethingElse</span>(<span class="parameter" id="doSomethingElse-param-aThingParameter"><span class="type-annotation">int</span> <span class="parameter-name">aThingParameter</span>, </span>'
3463
- '<span class="parameter" id="doSomethingElse-param-somethingElse"><span class="type-annotation">double</span> <span class="parameter-name">somethingElse</span></span>)}</span>' );
3464
- }, skip : 'reenable with analyzer > 1.7.1' );
3467
+ '<span class="parameter" id="doSomethingElse-param-somethingElse"><span class="type-annotation">double</span> <span class="parameter-name">somethingElse</span></span>)? }</span>' );
3468
+ });
3465
3469
});
3466
3470
3467
3471
group ('Type expansion' , () {
@@ -3941,12 +3945,10 @@ String? topLevelFunction(int param1, bool param2, Cool coolBeans,
3941
3945
});
3942
3946
3943
3947
test ('annotations from getters and setters are accumulated in Fields' , () {
3944
- expect (
3945
- explicitGetterSetter.featuresAsString.contains ('a Getter Annotation' ),
3946
- isTrue);
3947
- expect (
3948
- explicitGetterSetter.featuresAsString.contains ('a Setter Annotation' ),
3949
- isTrue);
3948
+ expect (explicitGetterSetter.featuresAsString,
3949
+ contains ('a Getter Annotation' ));
3950
+ expect (explicitGetterSetter.featuresAsString,
3951
+ contains ('a Setter Annotation' ));
3950
3952
});
3951
3953
3952
3954
test ('Docs from inherited implicit accessors are preserved' , () {
@@ -3974,10 +3976,8 @@ String? topLevelFunction(int param1, bool param2, Cool coolBeans,
3974
3976
expect (documentedPartialFieldInSubclassOnly.readOnly, isTrue);
3975
3977
expect (documentedPartialFieldInSubclassOnly.documentationComment,
3976
3978
contains ('This getter is documented' ));
3977
- expect (
3978
- documentedPartialFieldInSubclassOnly.annotations
3979
- .contains (Feature .inheritedSetter),
3980
- isFalse);
3979
+ expect (documentedPartialFieldInSubclassOnly.annotations,
3980
+ isNot (contains (Feature .inheritedSetter)));
3981
3981
});
3982
3982
3983
3983
test ('@nodoc overridden in subclass for getter works' , () {
@@ -4000,22 +4000,16 @@ String? topLevelFunction(int param1, bool param2, Cool coolBeans,
4000
4000
expect (implicitGetterExplicitSetter.getter! .isInherited, isTrue);
4001
4001
expect (implicitGetterExplicitSetter.setter! .isInherited, isFalse);
4002
4002
expect (implicitGetterExplicitSetter.isInherited, isFalse);
4003
- expect (implicitGetterExplicitSetter.features.contains (Feature .inherited),
4004
- isFalse);
4003
+ expect (implicitGetterExplicitSetter.features,
4004
+ isNot (contains (Feature .inherited)));
4005
+ expect (implicitGetterExplicitSetter.features,
4006
+ contains (Feature .inheritedGetter));
4007
+ expect (implicitGetterExplicitSetter.features,
4008
+ isNot (contains (Feature .overrideFeature)));
4009
+ expect (implicitGetterExplicitSetter.features,
4010
+ contains (Feature .overrideSetter));
4005
4011
expect (
4006
- implicitGetterExplicitSetter.features
4007
- .contains (Feature .inheritedGetter),
4008
- isTrue);
4009
- expect (
4010
- implicitGetterExplicitSetter.features
4011
- .contains (Feature .overrideFeature),
4012
- isFalse);
4013
- expect (
4014
- implicitGetterExplicitSetter.features
4015
- .contains (Feature .overrideSetter),
4016
- isTrue);
4017
- expect (implicitGetterExplicitSetter.features.contains (Feature .readWrite),
4018
- isTrue);
4012
+ implicitGetterExplicitSetter.features, contains (Feature .readWrite));
4019
4013
expect (
4020
4014
implicitGetterExplicitSetter.oneLineDoc,
4021
4015
equals (
@@ -4030,22 +4024,16 @@ String? topLevelFunction(int param1, bool param2, Cool coolBeans,
4030
4024
expect (explicitGetterImplicitSetter.getter! .isInherited, isFalse);
4031
4025
expect (explicitGetterImplicitSetter.setter! .isInherited, isTrue);
4032
4026
expect (explicitGetterImplicitSetter.isInherited, isFalse);
4033
- expect (explicitGetterImplicitSetter.features.contains (Feature .inherited),
4034
- isFalse);
4035
- expect (
4036
- explicitGetterImplicitSetter.features
4037
- .contains (Feature .inheritedSetter),
4038
- isTrue);
4039
- expect (
4040
- explicitGetterImplicitSetter.features
4041
- .contains (Feature .overrideFeature),
4042
- isFalse);
4043
- expect (
4044
- explicitGetterImplicitSetter.features
4045
- .contains (Feature .overrideGetter),
4046
- isTrue);
4047
- expect (explicitGetterImplicitSetter.features.contains (Feature .readWrite),
4048
- isTrue);
4027
+ expect (explicitGetterImplicitSetter.features,
4028
+ isNot (contains (Feature .inherited)));
4029
+ expect (explicitGetterImplicitSetter.features,
4030
+ contains (Feature .inheritedSetter));
4031
+ expect (explicitGetterImplicitSetter.features,
4032
+ isNot (contains (Feature .overrideFeature)));
4033
+ expect (explicitGetterImplicitSetter.features,
4034
+ contains (Feature .overrideGetter));
4035
+ expect (
4036
+ explicitGetterImplicitSetter.features, contains (Feature .readWrite));
4049
4037
expect (explicitGetterImplicitSetter.oneLineDoc,
4050
4038
equals ('Getter doc for explicitGetterImplicitSetter' ));
4051
4039
// Even though we have some new setter docs, getter still takes priority.
@@ -4167,9 +4155,8 @@ String? topLevelFunction(int param1, bool param2, Cool coolBeans,
4167
4155
() {
4168
4156
var withGenericSub =
4169
4157
exLibrary.classes.firstWhere ((c) => c.name == 'WithGenericSub' );
4170
- expect (
4171
- withGenericSub.inheritedFields.where ((p) => p.name == 'prop' ).length,
4172
- equals (1 ));
4158
+ expect (withGenericSub.inheritedFields.where ((p) => p.name == 'prop' ),
4159
+ hasLength (1 ));
4173
4160
});
4174
4161
});
4175
4162
@@ -4866,7 +4853,7 @@ String? topLevelFunction(int param1, bool param2, Cool coolBeans,
4866
4853
test ('uses = instead of : to set default value' , () {
4867
4854
final rendered =
4868
4855
ParameterRendererHtml ().renderLinkedParams ([intCheckOptional]);
4869
- expect (rendered. contains ('</span> = <span' ), isTrue );
4856
+ expect (rendered, contains ('</span> = <span' ));
4870
4857
});
4871
4858
4872
4859
test ('linkedName' , () {
@@ -4880,7 +4867,8 @@ String? topLevelFunction(int param1, bool param2, Cool coolBeans,
4880
4867
test ('param with generics' , () {
4881
4868
var params = ParameterRendererHtml ()
4882
4869
.renderLinkedParams (methodWithGenericParam.parameters);
4883
- expect (params.contains ('List' ) && params.contains ('Apple' ), isTrue);
4870
+ expect (params, contains ('List' ));
4871
+ expect (params, contains ('Apple' ));
4884
4872
});
4885
4873
4886
4874
test ('commas on same param line' , () {
@@ -4987,9 +4975,9 @@ String? topLevelFunction(int param1, bool param2, Cool coolBeans,
4987
4975
test ('Cat has implementors' , () {
4988
4976
expect (implC, hasLength (3 ));
4989
4977
var implementors = < String > ['B' , 'Dog' , 'ConstantCat' ];
4990
- expect (implementors. contains (implC[0 ].name), isTrue );
4991
- expect (implementors. contains (implC[1 ].name), isTrue );
4992
- expect (implementors. contains (implC[2 ].name), isTrue );
4978
+ expect (implementors, contains (implC[0 ].name));
4979
+ expect (implementors, contains (implC[1 ].name));
4980
+ expect (implementors, contains (implC[2 ].name));
4993
4981
});
4994
4982
4995
4983
test ('B does not have implementors' , () {
0 commit comments