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

Unified Diff: pkg/analyzer/test/src/dart/analysis/driver_test.dart

Issue 2808173002: Prioritize analysis of files that import the changed file, or have an error or warning. (Closed)
Patch Set: Created 3 years, 8 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/dart/analysis/driver_test.dart
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index 1bff4ea0def4bbe843ae3066eca4bf047826cebb..90b734f93b15c107ad547dfaaadf5f5dca5a6f1a 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -2179,6 +2179,72 @@ var A = B;
allResults.clear();
}
+ test_results_order() async {
+ var a = _p('/test/lib/a.dart');
+ var b = _p('/test/lib/b.dart');
+ var c = _p('/test/lib/c.dart');
+ var d = _p('/test/lib/d.dart');
+ var e = _p('/test/lib/e.dart');
+ var f = _p('/test/lib/f.dart');
+ provider.newFile(
+ a,
+ r'''
+import 'd.dart';
+''');
+ provider.newFile(b, '');
+ provider.newFile(
+ c,
+ r'''
+import 'd.dart';
+''');
+ provider.newFile(
+ d,
+ r'''
+import 'b.dart';
+''');
+ provider.newFile(
+ e,
+ r'''
+export 'b.dart';
+''');
+ provider.newFile(
+ f,
+ r'''
+import 'e.dart';
+class F extends X {}
+''');
+
+ driver.addFile(a);
+ driver.addFile(b);
+ driver.addFile(c);
+ driver.addFile(d);
+ driver.addFile(e);
+ driver.addFile(f);
+ await scheduler.waitForIdle();
+
+ // The file f.dart has an error or warning.
+ // So, its analysis will have higher priority.
+ expect(driver.fsState.getFileForPath(f).hasErrorOrWarning, isTrue);
+
+ allResults.clear();
+
+ // Update a.dart with changing its API signature.
+ provider.updateFile(b, 'class A {}');
+ driver.changeFile(b);
+ await scheduler.waitForIdle();
+
+ List<String> analyzedPaths = allResults.map((r) => r.path).toList();
+
+ // The changed file must be the first.
+ expect(analyzedPaths[0], b);
+
+ // Then the file that imports the changed file.
+ expect(analyzedPaths[1], d);
+
+ // Then the file that has an error (even if it is unrelated).
+ expect(analyzedPaths[2], f);
+ }
+
test_results_priority() async {
String content = 'int f() => 42;';
addTestFile(content, priority: true);

Powered by Google App Engine
This is Rietveld 408576698