@@ -494,7 +494,7 @@ void main() {
494
494
expect (
495
495
packageGraph
496
496
.localPackages.first.defaultCategory.publicLibraries.length,
497
- equals (8 ));
497
+ equals (9 ));
498
498
});
499
499
500
500
test ('Verify libraries with multiple categories show up in multiple places' ,
@@ -518,7 +518,7 @@ void main() {
518
518
expect (
519
519
packageGraph
520
520
.localPackages.first.defaultCategory.publicLibraries.length,
521
- equals (8 ));
521
+ equals (9 ));
522
522
});
523
523
});
524
524
@@ -588,7 +588,7 @@ void main() {
588
588
});
589
589
590
590
test ('libraries' , () {
591
- expect (packageGraph.localPublicLibraries, hasLength (13 ));
591
+ expect (packageGraph.localPublicLibraries, hasLength (14 ));
592
592
expect (interceptorsLib.isPublic, isFalse);
593
593
});
594
594
@@ -603,7 +603,7 @@ void main() {
603
603
604
604
Package package = packageGraph.localPackages.first;
605
605
expect (package.name, 'test_package' );
606
- expect (package.publicLibraries, hasLength (13 ));
606
+ expect (package.publicLibraries, hasLength (14 ));
607
607
});
608
608
609
609
test ('multiple packages, sorted default' , () {
@@ -696,7 +696,8 @@ void main() {
696
696
// If EventTarget really does start implementing hashCode, this will
697
697
// fail.
698
698
expect (hashCode.href, equals ('dart-core/Object/hashCode.html' ));
699
- expect (hashCode.canonicalEnclosingContainer, equals (objectModelElement));
699
+ expect (
700
+ hashCode.canonicalEnclosingContainer, equals (objectModelElement));
700
701
expect (
701
702
EventTarget .publicSuperChainReversed
702
703
.any ((et) => et.name == 'Interceptor' ),
@@ -720,13 +721,17 @@ void main() {
720
721
isDeprecated,
721
722
someLib,
722
723
reexportOneLib,
723
- reexportTwoLib;
724
- Class SomeClass , SomeOtherClass , YetAnotherClass , AUnicornClass ;
724
+ reexportTwoLib,
725
+ reexportThreeLib;
726
+ Class SomeClass ,
727
+ SomeOtherClass ,
728
+ YetAnotherClass ,
729
+ AUnicornClass ,
730
+ ADuplicateClass ;
725
731
726
732
setUpAll (() {
727
733
dartAsyncLib = utils.testPackageGraphSdk.libraries
728
734
.firstWhere ((l) => l.name == 'dart:async' );
729
-
730
735
anonLib = packageGraph.libraries
731
736
.firstWhere ((lib) => lib.name == 'anonymous_library' );
732
737
@@ -736,10 +741,13 @@ void main() {
736
741
.firstWhere ((lib) => lib.name == 'reexport_one' );
737
742
reexportTwoLib = packageGraph.libraries
738
743
.firstWhere ((lib) => lib.name == 'reexport_two' );
744
+ reexportThreeLib = packageGraph.libraries
745
+ .firstWhere ((lib) => lib.name == 'reexport_three' );
739
746
SomeClass = someLib.getClassByName ('SomeClass' );
740
747
SomeOtherClass = someLib.getClassByName ('SomeOtherClass' );
741
748
YetAnotherClass = someLib.getClassByName ('YetAnotherClass' );
742
749
AUnicornClass = someLib.getClassByName ('AUnicornClass' );
750
+ ADuplicateClass = reexportThreeLib.getClassByName ('ADuplicateClass' );
743
751
744
752
isDeprecated = packageGraph.libraries
745
753
.firstWhere ((lib) => lib.name == 'is_deprecated' );
@@ -871,6 +879,10 @@ void main() {
871
879
expect (SomeOtherClass .canonicalLibrary, reexportOneLib);
872
880
expect (SomeClass .canonicalLibrary, reexportTwoLib);
873
881
});
882
+
883
+ test ('with correct show/hide behavior' , () {
884
+ expect (ADuplicateClass .definingLibrary.name, equals ('shadowing_lib' ));
885
+ });
874
886
});
875
887
876
888
group ('Macros' , () {
@@ -2125,40 +2137,62 @@ void main() {
2125
2137
.firstWhere ((lib) => lib.name == 'reexport_one' );
2126
2138
reexportTwoLib = packageGraph.libraries
2127
2139
.firstWhere ((lib) => lib.name == 'reexport_two' );
2128
- documentOnceReexportOne = reexportOneLib.extensions.firstWhere ((e) => e.name == 'DocumentThisExtensionOnce' );
2129
- documentOnceReexportTwo = reexportTwoLib.extensions.firstWhere ((e) => e.name == 'DocumentThisExtensionOnce' );
2140
+ documentOnceReexportOne = reexportOneLib.extensions
2141
+ .firstWhere ((e) => e.name == 'DocumentThisExtensionOnce' );
2142
+ documentOnceReexportTwo = reexportTwoLib.extensions
2143
+ .firstWhere ((e) => e.name == 'DocumentThisExtensionOnce' );
2130
2144
2131
2145
ext = exLibrary.extensions.firstWhere ((e) => e.name == 'AppleExtension' );
2132
- extensionReferencer = exLibrary.classes.firstWhere ((c) => c.name == 'ExtensionReferencer' );
2146
+ extensionReferencer =
2147
+ exLibrary.classes.firstWhere ((c) => c.name == 'ExtensionReferencer' );
2133
2148
fancyList = exLibrary.extensions.firstWhere ((e) => e.name == 'FancyList' );
2134
- doSomeStuff = exLibrary.classes.firstWhere ((c) => c.name == 'ExtensionUser' )
2135
- .allInstanceMethods.firstWhere ((m) => m.name == 'doSomeStuff' );
2136
- doStuff = exLibrary.extensions.firstWhere ((e) => e.name == 'SimpleStringExtension' )
2137
- .instanceMethods.firstWhere ((m) => m.name == 'doStuff' );
2149
+ doSomeStuff = exLibrary.classes
2150
+ .firstWhere ((c) => c.name == 'ExtensionUser' )
2151
+ .allInstanceMethods
2152
+ .firstWhere ((m) => m.name == 'doSomeStuff' );
2153
+ doStuff = exLibrary.extensions
2154
+ .firstWhere ((e) => e.name == 'SimpleStringExtension' )
2155
+ .instanceMethods
2156
+ .firstWhere ((m) => m.name == 'doStuff' );
2138
2157
extensions = exLibrary.publicExtensions.toList ();
2139
2158
});
2140
2159
2141
2160
test ('basic canonicalization for extensions' , () {
2142
2161
expect (documentOnceReexportOne.isCanonical, isFalse);
2143
- expect (documentOnceReexportOne.href, equals (documentOnceReexportTwo.href));
2162
+ expect (
2163
+ documentOnceReexportOne.href, equals (documentOnceReexportTwo.href));
2144
2164
expect (documentOnceReexportTwo.isCanonical, isTrue);
2145
2165
});
2146
2166
2147
2167
// TODO(jcollins-g): implement feature and update tests
2148
2168
test ('documentation links do not crash in base cases' , () {
2149
- packageGraph.packageWarningCounter.hasWarning (doStuff, PackageWarning .notImplemented,
2169
+
2170
+ packageGraph.packageWarningCounter.hasWarning (
2171
+ doStuff,
2172
+ PackageWarning .notImplemented,
2150
2173
'Comment reference resolution inside extension methods is not yet implemented' );
2151
- packageGraph.packageWarningCounter.hasWarning (doSomeStuff, PackageWarning .notImplemented,
2174
+ packageGraph.packageWarningCounter.hasWarning (
2175
+ doSomeStuff,
2176
+ PackageWarning .notImplemented,
2152
2177
'Comment reference resolution inside extension methods is not yet implemented' );
2153
2178
expect (doStuff.documentationAsHtml, contains ('<code>another</code>' ));
2154
- expect (doSomeStuff.documentationAsHtml, contains ('<code>String.extensionNumber</code>' ));
2179
+ expect (doSomeStuff.documentationAsHtml,
2180
+ contains ('<code>String.extensionNumber</code>' ));
2155
2181
});
2156
2182
2157
- test ('references from outside an extension refer correctly to the extension' , () {
2158
- expect (extensionReferencer.documentationAsHtml, contains ('<code>_Shhh</code>' ));
2159
- expect (extensionReferencer.documentationAsHtml, contains ('<a href="ex/FancyList.html">FancyList</a>' ));
2160
- expect (extensionReferencer.documentationAsHtml, contains ('<a href="ex/AnExtension/call.html">AnExtension.call</a>' ));
2161
- expect (extensionReferencer.documentationAsHtml, contains ('<a href="reexport_two/DocumentThisExtensionOnce.html">DocumentThisExtensionOnce</a>' ));
2183
+ test (
2184
+ 'references from outside an extension refer correctly to the extension' ,
2185
+ () {
2186
+ expect (extensionReferencer.documentationAsHtml,
2187
+ contains ('<code>_Shhh</code>' ));
2188
+ expect (extensionReferencer.documentationAsHtml,
2189
+ contains ('<a href="ex/FancyList.html">FancyList</a>' ));
2190
+ expect (extensionReferencer.documentationAsHtml,
2191
+ contains ('<a href="ex/AnExtension/call.html">AnExtension.call</a>' ));
2192
+ expect (
2193
+ extensionReferencer.documentationAsHtml,
2194
+ contains (
2195
+ '<a href="reexport_two/DocumentThisExtensionOnce.html">DocumentThisExtensionOnce</a>' ));
2162
2196
});
2163
2197
2164
2198
test ('has a fully qualified name' , () {
@@ -2190,10 +2224,8 @@ void main() {
2190
2224
});
2191
2225
2192
2226
test ('extended type has generics' , () {
2193
- expect (
2194
- fancyList.extendedType.nameWithGenerics,
2195
- equals (
2196
- 'List<<wbr><span class="type-parameter">Z</span>>' ));
2227
+ expect (fancyList.extendedType.nameWithGenerics,
2228
+ equals ('List<<wbr><span class="type-parameter">Z</span>>' ));
2197
2229
});
2198
2230
2199
2231
test ('get methods' , () {
@@ -2231,7 +2263,8 @@ void main() {
2231
2263
2232
2264
setUpAll (() {
2233
2265
animal = exLibrary.enums.firstWhere ((e) => e.name == 'Animal' );
2234
- animalToString = animal.allInstanceMethods.firstWhere ((m) => m.name == 'toString' );
2266
+ animalToString =
2267
+ animal.allInstanceMethods.firstWhere ((m) => m.name == 'toString' );
2235
2268
2236
2269
/// Trigger code reference resolution
2237
2270
animal.documentationAsHtml;
@@ -2876,11 +2909,11 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
2876
2909
});
2877
2910
2878
2911
test ('Fields always have line and column information' , () {
2879
- expect (implicitGetterExplicitSetter.characterLocation, isNotNull);
2880
- expect (explicitGetterImplicitSetter.characterLocation, isNotNull);
2881
- expect (explicitGetterSetter.characterLocation, isNotNull);
2882
- expect (constField.characterLocation, isNotNull);
2883
- expect (aProperty.characterLocation, isNotNull);
2912
+ expect (implicitGetterExplicitSetter.characterLocation, isNotNull);
2913
+ expect (explicitGetterImplicitSetter.characterLocation, isNotNull);
2914
+ expect (explicitGetterSetter.characterLocation, isNotNull);
2915
+ expect (constField.characterLocation, isNotNull);
2916
+ expect (aProperty.characterLocation, isNotNull);
2884
2917
});
2885
2918
2886
2919
test ('covariant fields are recognized' , () {
@@ -3387,7 +3420,10 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
3387
3420
Constructor appleConstructorFromString;
3388
3421
Constructor constructorTesterDefault, constructorTesterFromSomething;
3389
3422
Constructor syntheticConstructor;
3390
- Class apple, constCat, constructorTester, referToADefaultConstructor,
3423
+ Class apple,
3424
+ constCat,
3425
+ constructorTester,
3426
+ referToADefaultConstructor,
3391
3427
withSyntheticConstructor;
3392
3428
setUpAll (() {
3393
3429
apple = exLibrary.classes.firstWhere ((c) => c.name == 'Apple' );
@@ -3405,7 +3441,8 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
3405
3441
.firstWhere ((c) => c.name == 'ConstructorTester.fromSomething' );
3406
3442
referToADefaultConstructor = fakeLibrary.classes
3407
3443
.firstWhere ((c) => c.name == 'ReferToADefaultConstructor' );
3408
- withSyntheticConstructor = exLibrary.classes.firstWhere ((c) => c.name == 'WithSyntheticConstructor' );
3444
+ withSyntheticConstructor = exLibrary.classes
3445
+ .firstWhere ((c) => c.name == 'WithSyntheticConstructor' );
3409
3446
syntheticConstructor = withSyntheticConstructor.defaultConstructor;
3410
3447
});
3411
3448
0 commit comments