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

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

Issue 2155013002: Always update 'modificationTime' in _sourceChanged(). (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 | « 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 a851f55013cb35dd0e1293a146ce75ee23a92449..5d151bf32aa6fff62ee9afcb6d01a4ffd6f6a30e 100644
--- a/pkg/analyzer/test/src/context/context_test.dart
+++ b/pkg/analyzer/test/src/context/context_test.dart
@@ -11,6 +11,7 @@ import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/dart/element/visitor.dart';
+import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/memory_file_system.dart';
import 'package:analyzer/source/package_map_resolver.dart';
import 'package:analyzer/src/cancelable_future.dart';
@@ -279,6 +280,26 @@ int b = aa;''';
});
}
+ void test_applyChanges_changedSource_updateModificationTime() {
+ String path = '/test.dart';
+ File file = resourceProvider.newFile(path, 'var V = 1;');
+ Source source = file.createSource();
+ context.applyChanges(new ChangeSet()..addedSource(source));
+ // Analyze all.
+ _analyzeAll_assertFinished();
+ expect(context.analysisCache.getState(source, RESOLVED_UNIT),
+ CacheState.INVALID);
+ // Update the file and notify the context about the change.
+ resourceProvider.updateFile(path, 'var V = 2;');
+ context.applyChanges(new ChangeSet()..changedSource(source));
+ // The analysis results are invalidated.
+ // We have seen the new contents, so 'modificationTime' is also updated.
+ expect(context.analysisCache.getState(source, RESOLVED_UNIT),
+ CacheState.INVALID);
+ expect(
+ context.getCacheEntry(source).modificationTime, file.modificationStamp);
+ }
+
void test_applyChanges_empty() {
context.applyChanges(new ChangeSet());
expect(context.performAnalysisTask().changeNotices, isNull);
@@ -2122,7 +2143,7 @@ library expectedToFindSemicolon
if (context.analysisOptions.finerGrainedInvalidation) {
expect(source.readCount, 7);
} else {
- expect(source.readCount, 4);
+ expect(source.readCount, 5);
}
}
« 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