Index: pkg/analyzer/test/src/summary/pub_summary_test.dart |
diff --git a/pkg/analyzer/test/src/summary/pub_summary_test.dart b/pkg/analyzer/test/src/summary/pub_summary_test.dart |
index 1224f9ff0b0ae688be476b82c1abde7c05bc4f66..f17df0e205c4018a0a261db9998e04c90bb8ca53 100644 |
--- a/pkg/analyzer/test/src/summary/pub_summary_test.dart |
+++ b/pkg/analyzer/test/src/summary/pub_summary_test.dart |
@@ -34,119 +34,6 @@ class PubSummaryManagerTest extends AbstractContextTest { |
_createManager(); |
} |
- test_computeSdkExtension() async { |
- // Create package files. |
- resourceProvider.newFile( |
- '$CACHE/aaa/lib/a.dart', |
- ''' |
-class A {} |
-'''); |
- resourceProvider.newFile( |
- '$CACHE/aaa/sdk_ext/extA.dart', |
- ''' |
-library test.a; |
-import 'dart:async'; |
-part 'src/p1.dart'; |
-part 'src/p2.dart'; |
-class ExtA {} |
-int V0; |
-'''); |
- resourceProvider.newFile( |
- '$CACHE/aaa/sdk_ext/src/p1.dart', |
- ''' |
-part of test.a; |
-class ExtAA {} |
-double V1; |
-'''); |
- resourceProvider.newFile( |
- '$CACHE/aaa/sdk_ext/src/p2.dart', |
- ''' |
-part of test.a; |
-class ExtAB {} |
-Future V2; |
-'''); |
- resourceProvider.newFile( |
- '$CACHE/aaa/lib/_sdkext', |
- ''' |
-{ |
- "dart:aaa.internal": "../sdk_ext/extA.dart" |
-} |
-'''); |
- resourceProvider.newFile( |
- '$CACHE/bbb/lib/b.dart', |
- ''' |
-class B {} |
-'''); |
- |
- // Configure packages resolution. |
- Folder libFolderA = resourceProvider.newFolder('$CACHE/aaa/lib'); |
- Folder libFolderB = resourceProvider.newFolder('$CACHE/bbb/lib'); |
- context.sourceFactory = new SourceFactory(<UriResolver>[ |
- sdkResolver, |
- resourceResolver, |
- new PackageMapUriResolver(resourceProvider, { |
- 'aaa': [libFolderA], |
- 'bbb': [libFolderB], |
- }) |
- ]); |
- |
- PackageBundle sdkBundle = sdk.getLinkedBundle(); |
- PackageBundle bundle = manager.computeSdkExtension(context, sdkBundle); |
- expect(bundle, isNotNull); |
- expect(bundle.linkedLibraryUris, ['dart:aaa.internal']); |
- expect(bundle.unlinkedUnitUris, [ |
- 'dart:aaa.internal', |
- 'dart:aaa.internal/src/p1.dart', |
- 'dart:aaa.internal/src/p2.dart' |
- ]); |
- expect(bundle.unlinkedUnits, hasLength(3)); |
- expect(bundle.unlinkedUnits[0].classes.map((c) => c.name), ['ExtA']); |
- expect(bundle.unlinkedUnits[1].classes.map((c) => c.name), ['ExtAA']); |
- expect(bundle.unlinkedUnits[2].classes.map((c) => c.name), ['ExtAB']); |
- // The library is linked. |
- expect(bundle.linkedLibraries, hasLength(1)); |
- LinkedLibrary linkedLibrary = bundle.linkedLibraries[0]; |
- // V0 is linked |
- { |
- UnlinkedUnit unlinkedUnit = bundle.unlinkedUnits[0]; |
- LinkedUnit linkedUnit = linkedLibrary.units[0]; |
- expect(unlinkedUnit.variables, hasLength(1)); |
- UnlinkedVariable variable = unlinkedUnit.variables[0]; |
- expect(variable.name, 'V0'); |
- int typeRef = variable.type.reference; |
- expect(unlinkedUnit.references[typeRef].name, 'int'); |
- LinkedReference linkedReference = linkedUnit.references[typeRef]; |
- expect(linkedLibrary.dependencies[linkedReference.dependency].uri, |
- 'dart:core'); |
- } |
- // V1 is linked |
- { |
- UnlinkedUnit unlinkedUnit = bundle.unlinkedUnits[1]; |
- LinkedUnit linkedUnit = linkedLibrary.units[1]; |
- expect(unlinkedUnit.variables, hasLength(1)); |
- UnlinkedVariable variable = unlinkedUnit.variables[0]; |
- expect(variable.name, 'V1'); |
- int typeRef = variable.type.reference; |
- expect(unlinkedUnit.references[typeRef].name, 'double'); |
- LinkedReference linkedReference = linkedUnit.references[typeRef]; |
- expect(linkedLibrary.dependencies[linkedReference.dependency].uri, |
- 'dart:core'); |
- } |
- // V2 is linked |
- { |
- UnlinkedUnit unlinkedUnit = bundle.unlinkedUnits[2]; |
- LinkedUnit linkedUnit = linkedLibrary.units[2]; |
- expect(unlinkedUnit.variables, hasLength(1)); |
- UnlinkedVariable variable = unlinkedUnit.variables[0]; |
- expect(variable.name, 'V2'); |
- int typeRef = variable.type.reference; |
- expect(unlinkedUnit.references[typeRef].name, 'Future'); |
- LinkedReference linkedReference = linkedUnit.references[typeRef]; |
- expect(linkedLibrary.dependencies[linkedReference.dependency].uri, |
- 'dart:async'); |
- } |
- } |
- |
test_computeUnlinkedForFolder() async { |
// Create package files. |
resourceProvider.newFile( |
@@ -373,123 +260,6 @@ A b; |
} |
} |
- test_getLinkedBundles_cached_useSdkExtension() async { |
- String pathA1 = '$CACHE/aaa-1.0.0'; |
- String pathA2 = '$CACHE/aaa-2.0.0'; |
- // aaa-1.0.0 |
- resourceProvider.newFile( |
- '$pathA1/lib/a.dart', |
- ''' |
-class A {} |
-int a; |
-'''); |
- resourceProvider.newFile( |
- '$pathA1/sdk_ext/extA.dart', |
- ''' |
-class ExtA1 {} |
-'''); |
- resourceProvider.newFile( |
- '$pathA1/lib/_sdkext', |
- ''' |
-{ |
- "dart:aaa": "../sdk_ext/extA.dart" |
-} |
-'''); |
- // aaa-2.0.0 |
- resourceProvider.newFile( |
- '$pathA2/lib/a.dart', |
- ''' |
-class A {} |
-int a; |
-'''); |
- resourceProvider.newFile( |
- '$pathA2/sdk_ext/extA.dart', |
- ''' |
-class ExtA2 {} |
-'''); |
- resourceProvider.newFile( |
- '$pathA2/lib/_sdkext', |
- ''' |
-{ |
- "dart:aaa": "../sdk_ext/extA.dart" |
-} |
-'''); |
- // bbb |
- resourceProvider.newFile( |
- '$CACHE/bbb/lib/b.dart', |
- ''' |
-import 'package:aaa/a.dart'; |
-A b; |
-'''); |
- Folder folderA1 = resourceProvider.getFolder(pathA1); |
- Folder folderA2 = resourceProvider.getFolder(pathA2); |
- Folder folderB = resourceProvider.getFolder('$CACHE/bbb'); |
- |
- // Configure packages resolution. |
- Folder libFolderA1 = resourceProvider.newFolder('$pathA1/lib'); |
- Folder libFolderA2 = resourceProvider.newFolder('$pathA2/lib'); |
- Folder libFolderB = resourceProvider.newFolder('$CACHE/bbb/lib'); |
- context.sourceFactory = new SourceFactory(<UriResolver>[ |
- sdkResolver, |
- resourceResolver, |
- new PackageMapUriResolver(resourceProvider, { |
- 'aaa': [libFolderA1], |
- 'bbb': [libFolderB], |
- }) |
- ]); |
- |
- // Session 1. |
- // Create linked bundles and store them in files. |
- String linkedHashA; |
- String linkedHashB; |
- { |
- // Ensure unlinked bundles. |
- manager.getUnlinkedBundles(context); |
- await manager.onUnlinkedComplete; |
- |
- // Now we should be able to get linked bundles. |
- List<LinkedPubPackage> linkedPackages = manager.getLinkedBundles(context); |
- expect(linkedPackages, hasLength(2)); |
- |
- // Verify that files with linked bundles were created. |
- LinkedPubPackage packageA = _getLinkedPackage(linkedPackages, 'aaa'); |
- LinkedPubPackage packageB = _getLinkedPackage(linkedPackages, 'bbb'); |
- linkedHashA = packageA.linkedHash; |
- linkedHashB = packageB.linkedHash; |
- _assertFileExists(folderA1, 'linked_spec_$linkedHashA.ds'); |
- _assertFileExists(folderB, 'linked_spec_$linkedHashB.ds'); |
- } |
- |
- // Session 2. |
- // Use 'aaa-2.0.0', with a different SDK extension. |
- { |
- context.sourceFactory = new SourceFactory(<UriResolver>[ |
- sdkResolver, |
- resourceResolver, |
- new PackageMapUriResolver(resourceProvider, { |
- 'aaa': [libFolderA2], |
- 'bbb': [libFolderB], |
- }) |
- ]); |
- |
- // Ensure unlinked bundles. |
- manager.getUnlinkedBundles(context); |
- await manager.onUnlinkedComplete; |
- |
- // Now we should be able to get linked bundles. |
- List<LinkedPubPackage> linkedPackages = manager.getLinkedBundles(context); |
- expect(linkedPackages, hasLength(2)); |
- |
- // Verify that new files with linked bundles were created. |
- LinkedPubPackage packageA = _getLinkedPackage(linkedPackages, 'aaa'); |
- LinkedPubPackage packageB = _getLinkedPackage(linkedPackages, 'bbb'); |
- expect(packageA.linkedHash, isNot(linkedHashA)); |
- expect(packageB.linkedHash, isNot(linkedHashB)); |
- _assertFileExists(folderA2, 'linked_spec_${packageA.linkedHash}.ds'); |
- _assertFileExists(folderB, 'linked_spec_${packageB.linkedHash}.ds'); |
- } |
- } |
- |
test_getLinkedBundles_hasCycle() async { |
resourceProvider.newFile( |
'$CACHE/aaa/lib/a.dart', |
@@ -1045,69 +815,6 @@ class C {} |
} |
} |
- test_getLinkedBundles_useSdkExtension() async { |
- resourceProvider.newFile( |
- '$CACHE/aaa/lib/a.dart', |
- ''' |
-import 'dart:bbb'; |
-ExtB a; |
-'''); |
- resourceProvider.newFile( |
- '$CACHE/bbb/lib/b.dart', |
- ''' |
-import 'dart:bbb'; |
-ExtB b; |
-'''); |
- resourceProvider.newFile( |
- '$CACHE/bbb/sdk_ext/extB.dart', |
- ''' |
-class ExtB {} |
-'''); |
- resourceProvider.newFile( |
- '$CACHE/bbb/lib/_sdkext', |
- ''' |
-{ |
- "dart:bbb": "../sdk_ext/extB.dart" |
-} |
-'''); |
- |
- // Configure packages resolution. |
- Folder libFolderA = resourceProvider.newFolder('$CACHE/aaa/lib'); |
- Folder libFolderB = resourceProvider.newFolder('$CACHE/bbb/lib'); |
- context.sourceFactory = new SourceFactory(<UriResolver>[ |
- sdkResolver, |
- resourceResolver, |
- new PackageMapUriResolver(resourceProvider, { |
- 'aaa': [libFolderA], |
- 'bbb': [libFolderB], |
- }) |
- ]); |
- |
- // Ensure unlinked bundles. |
- manager.getUnlinkedBundles(context); |
- await manager.onUnlinkedComplete; |
- |
- // Now we should be able to get linked bundles. |
- List<LinkedPubPackage> linkedPackages = manager.getLinkedBundles(context); |
- expect(linkedPackages, hasLength(2)); |
- |
- // package:aaa |
- { |
- LinkedPubPackage linkedPackage = linkedPackages |
- .singleWhere((linkedPackage) => linkedPackage.package.name == 'aaa'); |
- _assertHasLinkedVariable(linkedPackage, 'a', 'ExtB', |
- expectedTypeNameUri: 'dart:bbb'); |
- } |
- |
- // package:bbb |
- { |
- LinkedPubPackage linkedPackage = linkedPackages |
- .singleWhere((linkedPackage) => linkedPackage.package.name == 'bbb'); |
- _assertHasLinkedVariable(linkedPackage, 'b', 'ExtB', |
- expectedTypeNameUri: 'dart:bbb'); |
- } |
- } |
- |
test_getLinkedBundles_wrongScheme() async { |
resourceProvider.newFile( |
'$CACHE/aaa/lib/a.dart', |