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

Unified Diff: pkg/front_end/test/incremental_kernel_generator_test.dart

Issue 2933153002: Report unused files to watch. (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
Index: pkg/front_end/test/incremental_kernel_generator_test.dart
diff --git a/pkg/front_end/test/incremental_kernel_generator_test.dart b/pkg/front_end/test/incremental_kernel_generator_test.dart
index c7cd4cd79169edf51620c7a6f18080b0a5f72e19..5e02eccc702752fb7654c2760dd7f266dc73e37e 100644
--- a/pkg/front_end/test/incremental_kernel_generator_test.dart
+++ b/pkg/front_end/test/incremental_kernel_generator_test.dart
@@ -700,9 +700,13 @@ import 'a.dart';
''');
var usedFiles = <Uri>[];
+ var unusedFiles = <Uri>[];
watchFn = (Uri uri, bool used) {
- expect(used, isTrue);
- usedFiles.add(uri);
+ if (used) {
+ usedFiles.add(uri);
+ } else {
+ unusedFiles.add(uri);
+ }
return new Future.value();
};
@@ -712,6 +716,7 @@ import 'a.dart';
expect(usedFiles, contains(cUri));
expect(usedFiles, contains(aUri));
usedFiles.clear();
+ expect(unusedFiles, isEmpty);
}
// Update c.dart to reference also b.dart file.
@@ -727,6 +732,23 @@ import 'b.dart';
// The only new file is b.dart now.
expect(usedFiles, [bUri]);
usedFiles.clear();
+ expect(unusedFiles, isEmpty);
+ }
+
+ // Update c.dart to stop referencing b.dart file.
+ writeFile(
+ cPath,
+ r'''
+import 'a.dart';
+''');
+ incrementalKernelGenerator.invalidate(cUri);
+ {
+ await incrementalKernelGenerator.computeDelta();
+ // No new used files.
+ expect(usedFiles, isEmpty);
+ // The file b.dart is not used anymore.
+ expect(unusedFiles, [bUri]);
+ unusedFiles.clear();
}
}
« no previous file with comments | « pkg/front_end/lib/src/incremental_kernel_generator_impl.dart ('k') | pkg/front_end/test/src/incremental/file_state_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698