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

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

Issue 2337073003: Safe handle removed file while incremental invalidation. (Closed)
Patch Set: Created 4 years, 3 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 9ae0f83af84d0ff7dcf1b11cf7950438516947a7..490ba818debcc3c6b67abb2ec5c18703072e8004 100644
--- a/pkg/analyzer/test/src/context/context_test.dart
+++ b/pkg/analyzer/test/src/context/context_test.dart
@@ -2878,6 +2878,34 @@ class LimitedInvalidateTest extends AbstractContextTest {
context.analysisOptions = options;
}
+ void test_applyChanges_changedSource_removeFile() {
+ File file = resourceProvider.newFile('/test.dart', 'main() {}');
+ Source source = file.createSource();
+ context.applyChanges(new ChangeSet()..addedSource(source));
+ // Analyze all.
+ _performPendingAnalysisTasks();
+ expect(context.getResolvedCompilationUnit2(source, source), isNotNull);
+ // Delete the file, but tell the context that it is changed.
+ // This might happen as a race condition.
+ // Or it might be a mishandling of file notification events.
+ file.delete();
+ context.applyChanges(new ChangeSet()..changedSource(source));
+ // All the analysis results are gone.
+ void noResolvedUnits() {
+ LibrarySpecificUnit unit = new LibrarySpecificUnit(source, source);
+ RESOLVED_UNIT_RESULTS.forEach((result) {
+ expect(context.getResult(unit, result), isNull);
+ });
+ }
+
+ noResolvedUnits();
+ // Analyze again.
+ // The source does not exist, so still no resolution.
+ _performPendingAnalysisTasks();
+ noResolvedUnits();
+ expect(context.getModificationStamp(source), -1);
+ }
+
void test_class_addMethod_useAsHole_inTopLevelVariable() {
Source a = addSource(
'/a.dart',
« 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