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

Unified Diff: pkg/front_end/test/src/incremental/file_state_test.dart

Issue 2937103002: Cache transitive files in FileState. (Closed)
Patch Set: Created 3 years, 6 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/front_end/lib/src/incremental/file_state.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/test/src/incremental/file_state_test.dart
diff --git a/pkg/front_end/test/src/incremental/file_state_test.dart b/pkg/front_end/test/src/incremental/file_state_test.dart
index 53e599737a86724ee8933a2c668e4d3e7f20402e..b195da40380ea6e84bd090eb920e3e6629869399 100644
--- a/pkg/front_end/test/src/incremental/file_state_test.dart
+++ b/pkg/front_end/test/src/incremental/file_state_test.dart
@@ -491,6 +491,38 @@ import 'b.dart';
expect(order[2].libraries, unorderedEquals([b, c]));
}
+ test_transitiveFiles() async {
+ var a = writeFile('/a.dart', "");
+ var b = writeFile('/b.dart', "");
+ var c = writeFile('/c.dart', "import 'b.dart';");
+
+ FileState aFile = await fsState.getFile(a);
+ FileState bFile = await fsState.getFile(b);
+ FileState cFile = await fsState.getFile(c);
+
+ // Only c.dart and b.dart are in the transitive closure.
+ expect(cFile.transitiveFiles, contains(cFile));
+ expect(cFile.transitiveFiles, contains(bFile));
+ expect(cFile.transitiveFiles, isNot(contains(aFile)));
+ expect(bFile.transitiveFiles, isNot(contains(aFile)));
+
+ // Import a.dart into b.dart, changes c.dart transitive closure.
+ writeFile('/b.dart', "import 'a.dart';");
+ await bFile.refresh();
+ expect(cFile.transitiveFiles, contains(cFile));
+ expect(cFile.transitiveFiles, contains(bFile));
+ expect(cFile.transitiveFiles, contains(aFile));
+ expect(bFile.transitiveFiles, contains(aFile));
+
+ // Stop importing a.dart into b.dart, changes c.dart transitive closure.
+ writeFile('/b.dart', "");
+ await bFile.refresh();
+ expect(cFile.transitiveFiles, contains(cFile));
+ expect(cFile.transitiveFiles, contains(bFile));
+ expect(cFile.transitiveFiles, isNot(contains(aFile)));
+ expect(bFile.transitiveFiles, isNot(contains(aFile)));
+ }
+
/// Write the given [text] of the file with the given [path] into the
/// virtual filesystem. Return the URI of the file.
Uri writeFile(String path, String text) {
« no previous file with comments | « pkg/front_end/lib/src/incremental/file_state.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698