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

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

Issue 2157973002: Test that after context.applyChanges() with limited invalidation, results are correctly recomputed. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | 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 07e2719a55b29cb233faa77747e19b8490eb8ff4..0ab8f4736c4ac79fdd23d706df17dc864ae5cc0c 100644
--- a/pkg/analyzer/test/src/context/context_test.dart
+++ b/pkg/analyzer/test/src/context/context_test.dart
@@ -3311,6 +3311,48 @@ int B = _A + 1;
_assertInvalid(b, LIBRARY_ERRORS_READY);
}
+ void test_sequence_applyChanges_changedSource() {
+ Source a = addSource(
+ '/a.dart',
+ r'''
+class A {}
+class B {}
+''');
+ Source b = addSource(
+ '/b.dart',
+ r'''
+import 'a.dart';
+main() {
+ new A();
+ new B();
+}
+''');
+ _performPendingAnalysisTasks();
+ resourceProvider.updateFile(
+ '/a.dart',
+ r'''
+class A2 {}
+class B {}
+''');
+ // Update a.dart: remove A, add A2.
+ // b.dart is invalid, because it references A.
+ var changeSet = new ChangeSet()..changedSource(a);
+ context.applyChanges(changeSet);
+ _assertValidForChangedLibrary(a);
+ _assertInvalid(a, LIBRARY_ERRORS_READY);
+ _assertValidForDependentLibrary(b);
+ _assertInvalid(b, LIBRARY_ERRORS_READY);
+ _assertInvalidUnits(b, RESOLVED_UNIT4);
+ // Analyze.
+ _performPendingAnalysisTasks();
+ expect(context.getErrors(a).errors, hasLength(0));
+ expect(context.getErrors(b).errors, hasLength(1));
+ _assertValid(a, READY_RESOLVED_UNIT);
+ _assertValid(b, READY_RESOLVED_UNIT);
+ _assertValidAllLibraryUnitResults(a);
+ _assertValidAllLibraryUnitResults(b);
+ }
+
void test_sequence_class_give_take() {
Source a = addSource(
'/a.dart',
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698