@@ -494,7 +494,7 @@ void main() {
494494 expect (
495495 packageGraph
496496 .localPackages.first.defaultCategory.publicLibraries.length,
497- equals (8 ));
497+ equals (9 ));
498498 });
499499
500500 test ('Verify libraries with multiple categories show up in multiple places' ,
@@ -518,7 +518,7 @@ void main() {
518518 expect (
519519 packageGraph
520520 .localPackages.first.defaultCategory.publicLibraries.length,
521- equals (8 ));
521+ equals (9 ));
522522 });
523523 });
524524
@@ -588,7 +588,7 @@ void main() {
588588 });
589589
590590 test ('libraries' , () {
591- expect (packageGraph.localPublicLibraries, hasLength (13 ));
591+ expect (packageGraph.localPublicLibraries, hasLength (14 ));
592592 expect (interceptorsLib.isPublic, isFalse);
593593 });
594594
@@ -603,7 +603,7 @@ void main() {
603603
604604 Package package = packageGraph.localPackages.first;
605605 expect (package.name, 'test_package' );
606- expect (package.publicLibraries, hasLength (13 ));
606+ expect (package.publicLibraries, hasLength (14 ));
607607 });
608608
609609 test ('multiple packages, sorted default' , () {
@@ -696,7 +696,8 @@ void main() {
696696 // If EventTarget really does start implementing hashCode, this will
697697 // fail.
698698 expect (hashCode.href, equals ('dart-core/Object/hashCode.html' ));
699- expect (hashCode.canonicalEnclosingContainer, equals (objectModelElement));
699+ expect (
700+ hashCode.canonicalEnclosingContainer, equals (objectModelElement));
700701 expect (
701702 EventTarget .publicSuperChainReversed
702703 .any ((et) => et.name == 'Interceptor' ),
@@ -720,13 +721,17 @@ void main() {
720721 isDeprecated,
721722 someLib,
722723 reexportOneLib,
723- reexportTwoLib;
724- Class SomeClass , SomeOtherClass , YetAnotherClass , AUnicornClass ;
724+ reexportTwoLib,
725+ reexportThreeLib;
726+ Class SomeClass ,
727+ SomeOtherClass ,
728+ YetAnotherClass ,
729+ AUnicornClass ,
730+ ADuplicateClass ;
725731
726732 setUpAll (() {
727733 dartAsyncLib = utils.testPackageGraphSdk.libraries
728734 .firstWhere ((l) => l.name == 'dart:async' );
729-
730735 anonLib = packageGraph.libraries
731736 .firstWhere ((lib) => lib.name == 'anonymous_library' );
732737
@@ -736,10 +741,13 @@ void main() {
736741 .firstWhere ((lib) => lib.name == 'reexport_one' );
737742 reexportTwoLib = packageGraph.libraries
738743 .firstWhere ((lib) => lib.name == 'reexport_two' );
744+ reexportThreeLib = packageGraph.libraries
745+ .firstWhere ((lib) => lib.name == 'reexport_three' );
739746 SomeClass = someLib.getClassByName ('SomeClass' );
740747 SomeOtherClass = someLib.getClassByName ('SomeOtherClass' );
741748 YetAnotherClass = someLib.getClassByName ('YetAnotherClass' );
742749 AUnicornClass = someLib.getClassByName ('AUnicornClass' );
750+ ADuplicateClass = reexportThreeLib.getClassByName ('ADuplicateClass' );
743751
744752 isDeprecated = packageGraph.libraries
745753 .firstWhere ((lib) => lib.name == 'is_deprecated' );
@@ -871,6 +879,10 @@ void main() {
871879 expect (SomeOtherClass .canonicalLibrary, reexportOneLib);
872880 expect (SomeClass .canonicalLibrary, reexportTwoLib);
873881 });
882+
883+ test ('with correct show/hide behavior' , () {
884+ expect (ADuplicateClass .definingLibrary.name, equals ('shadowing_lib' ));
885+ });
874886 });
875887
876888 group ('Macros' , () {
@@ -2125,40 +2137,62 @@ void main() {
21252137 .firstWhere ((lib) => lib.name == 'reexport_one' );
21262138 reexportTwoLib = packageGraph.libraries
21272139 .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' );
21302144
21312145 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' );
21332148 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' );
21382157 extensions = exLibrary.publicExtensions.toList ();
21392158 });
21402159
21412160 test ('basic canonicalization for extensions' , () {
21422161 expect (documentOnceReexportOne.isCanonical, isFalse);
2143- expect (documentOnceReexportOne.href, equals (documentOnceReexportTwo.href));
2162+ expect (
2163+ documentOnceReexportOne.href, equals (documentOnceReexportTwo.href));
21442164 expect (documentOnceReexportTwo.isCanonical, isTrue);
21452165 });
21462166
21472167 // TODO(jcollins-g): implement feature and update tests
21482168 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,
21502173 '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,
21522177 'Comment reference resolution inside extension methods is not yet implemented' );
21532178 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>' ));
21552181 });
21562182
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>' ));
21622196 });
21632197
21642198 test ('has a fully qualified name' , () {
@@ -2190,10 +2224,8 @@ void main() {
21902224 });
21912225
21922226 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>>' ));
21972229 });
21982230
21992231 test ('get methods' , () {
@@ -2231,7 +2263,8 @@ void main() {
22312263
22322264 setUpAll (() {
22332265 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' );
22352268
22362269 /// Trigger code reference resolution
22372270 animal.documentationAsHtml;
@@ -2876,11 +2909,11 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
28762909 });
28772910
28782911 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);
28842917 });
28852918
28862919 test ('covariant fields are recognized' , () {
@@ -3387,7 +3420,10 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
33873420 Constructor appleConstructorFromString;
33883421 Constructor constructorTesterDefault, constructorTesterFromSomething;
33893422 Constructor syntheticConstructor;
3390- Class apple, constCat, constructorTester, referToADefaultConstructor,
3423+ Class apple,
3424+ constCat,
3425+ constructorTester,
3426+ referToADefaultConstructor,
33913427 withSyntheticConstructor;
33923428 setUpAll (() {
33933429 apple = exLibrary.classes.firstWhere ((c) => c.name == 'Apple' );
@@ -3405,7 +3441,8 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
34053441 .firstWhere ((c) => c.name == 'ConstructorTester.fromSomething' );
34063442 referToADefaultConstructor = fakeLibrary.classes
34073443 .firstWhere ((c) => c.name == 'ReferToADefaultConstructor' );
3408- withSyntheticConstructor = exLibrary.classes.firstWhere ((c) => c.name == 'WithSyntheticConstructor' );
3444+ withSyntheticConstructor = exLibrary.classes
3445+ .firstWhere ((c) => c.name == 'WithSyntheticConstructor' );
34093446 syntheticConstructor = withSyntheticConstructor.defaultConstructor;
34103447 });
34113448
0 commit comments