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

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

Issue 2228083002: Make API signature based only on unlinked data. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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
Index: pkg/analyzer/test/src/summary/linker_test.dart
diff --git a/pkg/analyzer/test/src/summary/linker_test.dart b/pkg/analyzer/test/src/summary/linker_test.dart
index 92a6fe97156c33d8848f0eb79bf26924b8085036..eb9e407da88255568a07a9643a1ee72b95c8fb5f 100644
--- a/pkg/analyzer/test/src/summary/linker_test.dart
+++ b/pkg/analyzer/test/src/summary/linker_test.dart
@@ -61,6 +61,42 @@ class LinkerUnitTest extends SummaryLinkerTest {
expect(bundle0.apiSignature, bundle1.apiSignature);
}
+ void test_apiSignature_orderChange() {
+ // A change to the order in which files are processed should not affect the
+ // API signature.
+ addNamedSource('/a.dart', 'class A {}');
+ var bundle0 = createPackageBundle('class B {}', path: '/b.dart');
+ addNamedSource('/b.dart', 'class B {}');
+ var bundle1 = createPackageBundle('class A {}', path: '/a.dart');
+ expect(bundle0.apiSignature, isNotEmpty);
+ expect(bundle1.apiSignature, isNotEmpty);
+ expect(bundle0.apiSignature, bundle1.apiSignature);
+ }
+
+ void test_apiSignature_unlinkedOnly() {
+ // The API signature of a package bundle should only contain unlinked
+ // information. In this test, the linked information for bundle2 and
+ // bundle3 refer to class C as existing in different files. But the
+ // unlinked information for bundle2 and bundle3 should be the same, so their
+ // API signatures should be the same.
+ addNamedSource('/a.dart', 'class C {}');
+ var bundle0 = createPackageBundle('', path: '/b.dart');
+ addNamedSource('/a.dart', '');
+ var bundle1 = createPackageBundle('class C {}', path: '/b.dart');
+ var text = '''
+import 'a.dart';
+import 'b.dart';
+class D extends C {}
+''';
+ addBundle('/bundle0.ds', bundle0);
+ var bundle2 = createPackageBundle(text, path: '/c.dart');
+ addBundle('/bundle1.ds', bundle1);
+ var bundle3 = createPackageBundle(text, path: '/c.dart');
+ expect(bundle2.apiSignature, isNotEmpty);
+ expect(bundle3.apiSignature, isNotEmpty);
+ expect(bundle2.apiSignature, bundle3.apiSignature);
+ }
+
void test_baseClass_genericWithAccessor() {
createLinker('''
class B<T> {

Powered by Google App Engine
This is Rietveld 408576698