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

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

Issue 1410813003: Reset AnalysisDriver after changes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
« 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 5519092e1df8ed4f461adb5dc2fb0eb16bbffd29..6c243ab15d3226b47958bb07794d02f7653ce2db 100644
--- a/pkg/analyzer/test/src/context/context_test.dart
+++ b/pkg/analyzer/test/src/context/context_test.dart
@@ -1807,6 +1807,31 @@ void g() { f(null); }''');
reason: "libA has an error");
}
+ void test_performAnalysisTask_interruptBy_setContents() {
+ Source sourceA = addSource(
+ "/a.dart",
+ r'''
+library expectedToFindSemicolon
+''');
+ // Analyze to the point where some of the results stop depending on
+ // the source content.
+ LibrarySpecificUnit unitA = new LibrarySpecificUnit(sourceA, sourceA);
+ for (int i = 0; i < 10000; i++) {
+ context.performAnalysisTask();
+ if (context.getResult(unitA, RESOLVED_UNIT2) != null) {
+ break;
+ }
+ }
+ // Update the source.
+ // This should invalidate all the results and also reset the driver.
+ context.setContents(sourceA, "library semicolonWasAdded;");
+ expect(context.getResult(unitA, RESOLVED_UNIT2), isNull);
+ expect(analysisDriver.currentWorkOrder, isNull);
+ // Continue analysis.
+ _analyzeAll_assertFinished();
+ expect(context.getErrors(sourceA).errors, isEmpty);
+ }
+
void test_performAnalysisTask_IOException() {
TestSource source = _addSourceWithException2("/test.dart", "library test;");
source.generateExceptionOnRead = false;
« 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