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

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

Issue 2929363002: Implement GC for FileState(s). (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_kernel_generator_impl.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 d4216889f9f78d1421e0b1053175f6e076040135..aa927f32f030360fb31b8f5478f7fc9a2934e4c5 100644
--- a/pkg/front_end/test/src/incremental/file_state_test.dart
+++ b/pkg/front_end/test/src/incremental/file_state_test.dart
@@ -141,6 +141,51 @@ baz() => 44;
''');
}
+ test_gc() async {
+ var a = writeFile('/a.dart', '');
+ var b = writeFile('/b.dart', '');
+ var c = writeFile('/c.dart', 'import "a.dart";');
+ var d = writeFile('/d.dart', 'import "b.dart";');
+ var e = writeFile(
+ '/e.dart',
+ r'''
+import "c.dart";
+import "d.dart";
+''');
+
+ var eFile = await fsState.getFile(e);
+
+ // The root and four files.
+ expect(fsState.fileUris, contains(e));
+ expect(fsState.fileUris, contains(a));
+ expect(fsState.fileUris, contains(b));
+ expect(fsState.fileUris, contains(c));
+ expect(fsState.fileUris, contains(d));
+
+ // No changes after GC.
+ fsState.gc(e);
+ expect(fsState.fileUris, contains(e));
+ expect(fsState.fileUris, contains(a));
+ expect(fsState.fileUris, contains(b));
+ expect(fsState.fileUris, contains(c));
+ expect(fsState.fileUris, contains(d));
+
+ // Update e.dart so that it does not reference c.dart anymore.
+ // Then GC removes both c.dart and a.dart it references.
+ writeFile(
+ '/e.dart',
+ r'''
+import "d.dart";
+''');
+ await eFile.refresh();
+ fsState.gc(e);
+ expect(fsState.fileUris, contains(e));
+ expect(fsState.fileUris, isNot(contains(a)));
+ expect(fsState.fileUris, contains(b));
+ expect(fsState.fileUris, isNot(contains(c)));
+ expect(fsState.fileUris, contains(d));
+ }
+
test_getFile() async {
var a = writeFile('/a.dart', '');
var b = writeFile('/b.dart', '');
« no previous file with comments | « pkg/front_end/lib/src/incremental_kernel_generator_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698