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

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

Issue 2458853003: Do nothing if [changeFile] reported, but the file content is the same. (Closed)
Patch Set: Created 4 years, 2 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 34e20efdbb12f04d3580a5b54762526a16ef8807..fb37be9a44669fdb74c9a4c84c6c38f1c7220ac0 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -77,7 +77,7 @@ class DriverTest {
})
], null, provider),
new AnalysisOptionsImpl()..strongMode = true);
- driver.status.lastWhere((status) {
+ driver.status.listen((status) {
allStatuses.add(status);
if (status.isIdle) {
idleStatusMonitor.notify();
@@ -141,6 +141,30 @@ var A = B;
}
}
+ test_changeFile_noContentChange_noNewResult() async {
+ _addTestFile('main() {}', priority: true);
+
+ // Initial analysis.
+ await _waitForIdle();
+ expect(allResults, hasLength(1));
+
+ // Update the file, but don't notify the driver.
+ // Don't update the file in the file system.
+ // But tell the driver the the file was changed.
+ // The driver should eventually check the file and ignore.
+ allStatuses.clear();
+ allResults.clear();
+ driver.changeFile(testFile);
+
+ // The driver switched to analysis and back to idle.
+ await _waitForIdle();
+ expect(allStatuses, hasLength(2));
+ expect(allStatuses.map((status) => status.isAnalyzing), [true, false]);
+
+ // No new results.
+ expect(allResults, isEmpty);
+ }
+
test_changeFile_selfConsistent() async {
var a = _p('/test/lib/a.dart');
var b = _p('/test/lib/b.dart');

Powered by Google App Engine
This is Rietveld 408576698