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

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

Issue 1580013003: Test dependency tracking of unused imports/exports. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/summary/summary_test.dart
diff --git a/pkg/analyzer/test/src/summary/summary_test.dart b/pkg/analyzer/test/src/summary/summary_test.dart
index 8b25e9da8f1f4dec181bb699da2a5b1fbdca75fd..99617290709319897c30e02a115295a90f489d00 100644
--- a/pkg/analyzer/test/src/summary/summary_test.dart
+++ b/pkg/analyzer/test/src/summary/summary_test.dart
@@ -558,6 +558,29 @@ abstract class SummaryTest {
expectedKind: PrelinkedReferenceKind.unresolved);
}
+ fail_dependencies_export_to_export_unused() {
+ // TODO(paulberry): fix this test.
+ addNamedSource('/a.dart', 'export "b.dart";');
+ addNamedSource('/b.dart', '');
+ serializeLibraryText('export "a.dart";');
+ // The main test library depends on b.dart, even though it doesn't
+ // re-export any names defined in b.dart, because a change to b.dart might
+ // cause it to start exporting a name that the main test library *does*
+ // use.
+ checkHasDependency(absUri('/b.dart'), 'b.dart');
+ }
+
+ fail_dependencies_export_unused() {
+ // TODO(paulberry): fix this test.
+ addNamedSource('/a.dart', '');
+ serializeLibraryText('export "a.dart";');
+ // The main test library depends on a.dart, even though it doesn't
+ // re-export any names defined in a.dart, because a change to a.dart might
+ // cause it to start exporting a name that the main test library *will*
+ // re-export.
+ checkHasDependency(absUri('/a.dart'), 'a.dart');
+ }
+
fail_enum_value_documented() {
// TODO(paulberry): currently broken because of dartbug.com/25385
String text = '''
@@ -1529,6 +1552,16 @@ class C {
checkHasDependency(absUri('/c.dart'), 'c.dart');
}
+ test_dependencies_import_to_export_unused() {
+ addNamedSource('/a.dart', 'export "b.dart";');
+ addNamedSource('/b.dart', '');
+ serializeLibraryText('import "a.dart";', allowErrors: true);
+ // The main test library depends on b.dart, even though it doesn't use any
+ // names defined in b.dart, because a change to b.dart might cause it to
+ // start exporting a name that the main test library *does* use.
+ checkHasDependency(absUri('/b.dart'), 'b.dart');
+ }
+
test_dependencies_import_transitive_closure() {
addNamedSource(
'/a.dart', 'library a; import "b.dart"; class A extends B {}');
@@ -1540,6 +1573,15 @@ class C {
checkLacksDependency(absUri('/b.dart'), 'b.dart');
}
+ test_dependencies_import_unused() {
+ addNamedSource('/a.dart', '');
+ serializeLibraryText('import "a.dart";', allowErrors: true);
+ // The main test library depends on a.dart, even though it doesn't use any
+ // names defined in a.dart, because a change to a.dart might cause it to
+ // start exporting a name that the main test library *does* use.
+ checkHasDependency(absUri('/a.dart'), 'a.dart');
+ }
+
test_dependencies_parts() {
addNamedSource(
'/a.dart', 'library a; part "b.dart"; part "c.dart"; class A {}');
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698