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

Unified Diff: pkg/analyzer/test/src/context/context_test.dart

Issue 2249833002: Reset analysis driver after incremental changes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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/analyzer/lib/src/context/context.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/context/context_test.dart
diff --git a/pkg/analyzer/test/src/context/context_test.dart b/pkg/analyzer/test/src/context/context_test.dart
index b005734298c2b122d5539d5c18586f326b7a85ed..adc77780f5e3831f0e01addaa197456a85803d6c 100644
--- a/pkg/analyzer/test/src/context/context_test.dart
+++ b/pkg/analyzer/test/src/context/context_test.dart
@@ -343,6 +343,49 @@ int b = aa;''';
expect(context.performAnalysisTask().changeNotices, isNull);
}
+ void test_applyChanges_incremental_resetDriver() {
+ context.analysisOptions = new AnalysisOptionsImpl()..incremental = true;
+ Source source = addSource(
+ "/test.dart",
+ r'''
+main() {
+ print(42);
+}
+''');
+ _performPendingAnalysisTasks();
+ expect(context.getErrors(source).errors, hasLength(0));
+ // Update the source to have a parse error.
+ // This is an incremental change, but we always invalidate DART_ERRORS.
+ context.setContents(
+ source,
+ r'''
+main() {
+ print(42)
+}
+''');
+ AnalysisCache cache = context.analysisCache;
+ expect(cache.getValue(source, PARSE_ERRORS), hasLength(1));
+ expect(cache.getState(source, DART_ERRORS), CacheState.INVALID);
+ // Perform enough analysis to prepare inputs (is not actually tested) for
+ // the DART_ERRORS computing task, but don't compute it yet.
+ context.performAnalysisTask();
+ context.performAnalysisTask();
+ expect(cache.getState(source, DART_ERRORS), CacheState.INVALID);
+ // Update the source so that PARSE_ERRORS is empty.
+ context.setContents(
+ source,
+ r'''
+main() {
+ print(42);
+}
+''');
+ expect(cache.getValue(source, PARSE_ERRORS), hasLength(0));
+ // After full analysis DART_ERRORS should also be empty.
+ _performPendingAnalysisTasks();
+ expect(cache.getValue(source, DART_ERRORS), hasLength(0));
+ expect(context.getErrors(source).errors, hasLength(0));
+ }
+
void test_applyChanges_overriddenSource() {
String content = "library test;";
Source source = addSource("/test.dart", content);
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698