Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: pkg/analyzer/test/src/summary/package_bundle_reader_test.dart

Issue 2829493002: Make conflicting summary check configurable (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/summary/package_bundle_reader.dart ('k') | pkg/dev_compiler/lib/sdk/ddc_sdk.sum » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/summary/package_bundle_reader_test.dart
diff --git a/pkg/analyzer/test/src/summary/package_bundle_reader_test.dart b/pkg/analyzer/test/src/summary/package_bundle_reader_test.dart
index a1caba3d0bbe41d31617998c092eb81c8708e8b1..13472f3842b7aa1193d3f1ea89db6fca5cc4a313 100644
--- a/pkg/analyzer/test/src/summary/package_bundle_reader_test.dart
+++ b/pkg/analyzer/test/src/summary/package_bundle_reader_test.dart
@@ -148,8 +148,8 @@ class ResynthesizerResultProviderTest {
@reflectiveTest
class SummaryDataStoreTest {
- SummaryDataStore dataStore =
- new SummaryDataStore(<String>[], recordDependencyInfo: true);
+ SummaryDataStore dataStore = new SummaryDataStore(<String>[],
+ recordDependencyInfo: true, disallowOverlappingSummaries: true);
PackageBundle bundle1 = new _PackageBundleMock();
PackageBundle bundle2 = new _PackageBundleMock();
@@ -159,7 +159,7 @@ class SummaryDataStoreTest {
LinkedLibrary linkedLibrary1 = new _LinkedLibraryMock();
LinkedLibrary linkedLibrary2 = new _LinkedLibraryMock();
- void setUp() {
+ void _setupDataStore(SummaryDataStore store) {
// bundle1
when(unlinkedUnit11.publicNamespace)
.thenReturn(_namespaceWithParts(['package:p1/u2.dart']));
@@ -171,7 +171,7 @@ class SummaryDataStoreTest {
when(bundle1.linkedLibraryUris).thenReturn(<String>['package:p1/u1.dart']);
when(bundle1.linkedLibraries).thenReturn(<LinkedLibrary>[linkedLibrary1]);
when(bundle1.apiSignature).thenReturn('signature1');
- dataStore.addBundle('/p1.ds', bundle1);
+ store.addBundle('/p1.ds', bundle1);
// bundle2
when(unlinkedUnit21.publicNamespace).thenReturn(_namespaceWithParts([]));
when(bundle2.unlinkedUnitUris).thenReturn(<String>['package:p2/u1.dart']);
@@ -179,7 +179,11 @@ class SummaryDataStoreTest {
when(bundle2.linkedLibraryUris).thenReturn(<String>['package:p2/u1.dart']);
when(bundle2.linkedLibraries).thenReturn(<LinkedLibrary>[linkedLibrary2]);
when(bundle2.apiSignature).thenReturn('signature2');
- dataStore.addBundle('/p2.ds', bundle2);
+ store.addBundle('/p2.ds', bundle2);
+ }
+
+ void setUp() {
+ _setupDataStore(dataStore);
}
test_addBundle() {
@@ -255,6 +259,26 @@ class SummaryDataStoreTest {
expect(dataStore.dependencies.last.includedPackageNames, ['p1', 'p2']);
}
+ test_addBundle_multiProjectOverlap() {
+ SummaryDataStore dataStore2 = new SummaryDataStore(<String>[],
+ recordDependencyInfo: true, disallowOverlappingSummaries: false);
+ _setupDataStore(dataStore2);
+
+ PackageBundle bundle = new _PackageBundleMock();
+ when(bundle.unlinkedUnitUris)
+ .thenReturn(<String>['package:p2/u1.dart', 'package:p1/u1.dart']);
+ when(bundle.unlinkedUnits)
+ .thenReturn(<UnlinkedUnit>[unlinkedUnit21, unlinkedUnit11]);
+ when(bundle.linkedLibraryUris)
+ .thenReturn(<String>['package:p2/u1.dart', 'package:p1/u1.dart']);
+ when(bundle.linkedLibraries)
+ .thenReturn(<LinkedLibrary>[linkedLibrary2, linkedLibrary1]);
+ when(bundle.apiSignature).thenReturn('signature');
+ // p3 conflicts (overlaps) with existing summaries, but now allowed.
+ dataStore2.addBundle('/p3.ds', bundle);
+ expect(dataStore2.dependencies.last.includedPackageNames, ['p1', 'p2']);
+ }
+
test_getContainingLibraryUris_libraryUri() {
String partUri = 'package:p1/u1.dart';
List<String> uris = dataStore.getContainingLibraryUris(partUri);
« no previous file with comments | « pkg/analyzer/lib/src/summary/package_bundle_reader.dart ('k') | pkg/dev_compiler/lib/sdk/ddc_sdk.sum » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698