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

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

Issue 1361003002: Reset Source modification stamp to -1 if it does not exist. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
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 ab4df6447dd1f1552de56db080282e648c1f8fca..a4980305c99c871c1c0a33de38805b96e4c90159 100644
--- a/pkg/analyzer/test/src/context/context_test.dart
+++ b/pkg/analyzer/test/src/context/context_test.dart
@@ -1772,14 +1772,14 @@ void g() { f(null); }''');
TestSource source = _addSourceWithException2("/test.dart", "library test;");
source.generateExceptionOnRead = false;
_analyzeAll_assertFinished();
- expect(source.readCount, 1);
+ expect(source.readCount, 2);
Brian Wilkerson 2015/09/23 13:53:38 I don't understand why this change would cause the
scheglov 2015/09/23 15:11:27 The scenario is following. 1. We add test.dart as
_changeSource(source, "");
source.generateExceptionOnRead = true;
_analyzeAll_assertFinished();
if (AnalysisEngine.instance.limitInvalidationInTaskModel) {
- expect(source.readCount, 5);
+ expect(source.readCount, 7);
} else {
- expect(source.readCount, 3);
+ expect(source.readCount, 5);
}
}
@@ -1869,6 +1869,15 @@ void g() { f(null); }''');
["dart.core", "dart.async", "dart.math", "libA", "libB"]);
}
+ void test_resolveCompilationUnit_library() {
+ Source source = addSource("/lib.dart", "library lib;");
+ LibraryElement library = context.computeLibraryElement(source);
+ CompilationUnit compilationUnit =
+ context.resolveCompilationUnit(source, library);
+ expect(compilationUnit, isNotNull);
+ expect(compilationUnit.element, isNotNull);
+ }
+
// void test_resolveCompilationUnit_sourceChangeDuringResolution() {
// _context = new _AnalysisContext_sourceChangeDuringResolution();
// AnalysisContextFactory.initContextWithCore(_context);
@@ -1880,15 +1889,6 @@ void g() { f(null); }''');
// expect(_context.getLineInfo(source), isNotNull);
// }
- void test_resolveCompilationUnit_library() {
- Source source = addSource("/lib.dart", "library lib;");
- LibraryElement library = context.computeLibraryElement(source);
- CompilationUnit compilationUnit =
- context.resolveCompilationUnit(source, library);
- expect(compilationUnit, isNotNull);
- expect(compilationUnit.element, isNotNull);
- }
-
void test_resolveCompilationUnit_source() {
Source source = addSource("/lib.dart", "library lib;");
CompilationUnit compilationUnit =
@@ -2073,6 +2073,22 @@ int a = 0;''');
expect(context.sourcesNeedingProcessing.contains(source), isFalse);
}
+ void test_validateCacheConsistency_deletedSource() {
+ MemoryResourceProvider resourceProvider = new MemoryResourceProvider();
+ var fileA = resourceProvider.newFile('/a.dart', "");
+ var fileB = resourceProvider.newFile('/b.dart', "import 'a.dart';");
+ Source sourceA = fileA.createSource();
+ Source sourceB = fileB.createSource();
+ context.applyChanges(
+ new ChangeSet()..addedSource(sourceA)..addedSource(sourceB));
+ // analyze everything
+ _analyzeAll_assertFinished();
+ // delete a.dart
+ resourceProvider.deleteFile('/a.dart');
+ // analysis should eventually stop
+ _analyzeAll_assertFinished();
+ }
+
void xtest_performAnalysisTask_stress() {
int maxCacheSize = 4;
AnalysisOptionsImpl options =
@@ -2123,7 +2139,10 @@ int a = 0;''');
for (int i = 0; i < maxIterations; i++) {
List<ChangeNotice> notice = context.performAnalysisTask().changeNotices;
if (notice == null) {
- return;
+ bool inconsistent = context.validateCacheConsistency();
+ if (!inconsistent) {
+ return;
+ }
}
}
fail("performAnalysisTask failed to terminate after analyzing all sources");
« pkg/analyzer/lib/src/context/context.dart ('K') | « 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