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

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

Issue 2579223003: Do nothing if the changed file is not known to the driver. (Closed)
Patch Set: Rollback file_state changes. Created 4 years 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/analyzer/lib/src/dart/analysis/driver.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 04e2fe95f8f4a6821bdc38fd4e756397203b6439..f14a6ca9d2cacc24e656929ed9ee4ef7e2450a16 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -362,6 +362,9 @@ var A = B;
provider.updateFile(b, 'var B = 1.2;');
driver.changeFile(b);
+ // "b" is not an added file, so it is not scheduled for analysis.
+ expect(driver.test.filesToAnalyze, isEmpty);
+
// While "b" is not analyzed explicitly, it is analyzed implicitly.
// The change causes "a" to be reanalyzed.
await _waitForIdle();
@@ -372,6 +375,28 @@ var A = B;
}
}
+ test_changeFile_notUsed() async {
+ var a = _p('/test/lib/a.dart');
+ var b = _p('/other/b.dart');
+ provider.newFile(a, '');
+ provider.newFile(b, 'class B1 {}');
+
+ driver.addFile(a);
+
+ await _waitForIdle();
+ allResults.clear();
+
+ // Change "b" and notify.
+ // Nothing depends on "b", so nothing is analyzed.
+ provider.updateFile(b, 'class B2 {}');
+ driver.changeFile(b);
+ await _waitForIdle();
+ expect(allResults, isEmpty);
+
+ // This should not add "b" to the file state.
+ expect(driver.fsState.knownFilePaths, isNot(contains(b)));
+ }
+
test_changeFile_selfConsistent() async {
var a = _p('/test/lib/a.dart');
var b = _p('/test/lib/b.dart');
@@ -455,6 +480,9 @@ var A2 = B1;
// Notify the driver about the change.
driver.changeFile(testFile);
+ // The file was added, so it is scheduled for analysis.
+ expect(driver.test.filesToAnalyze, contains(testFile));
+
// We get a new result.
{
await _waitForIdle();
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/driver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698