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

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

Issue 1420613003: Keep cache entries for explicitly added sources. (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/cache.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/cache_test.dart
diff --git a/pkg/analyzer/test/src/context/cache_test.dart b/pkg/analyzer/test/src/context/cache_test.dart
index b012ffdbe1e47cd675958b634923c6795204ff26..75c156a69de0055b3a63ada42df1875230d81a88 100644
--- a/pkg/analyzer/test/src/context/cache_test.dart
+++ b/pkg/analyzer/test/src/context/cache_test.dart
@@ -596,6 +596,21 @@ class CacheEntryTest extends AbstractCacheTest {
expect(cache.get(target), entry);
}
+ test_setState_invalid_keepEmpty_ifExplicitlyAdded() {
+ AnalysisTarget target = new TestSource('/a.dart');
+ CacheEntry entry = new CacheEntry(target);
+ entry.explicitlyAdded = true;
+ cache.put(entry);
+ ResultDescriptor result = new ResultDescriptor('result1', -1);
+ // set results, all of them are VALID
+ entry.setValue(result, 111, TargetedResult.EMPTY_LIST);
+ expect(entry.getState(result), CacheState.VALID);
+ expect(entry.getValue(result), 111);
+ // invalidate result, keep entry
+ entry.setState(result, CacheState.INVALID);
+ expect(cache.get(target), isNotNull);
+ }
+
test_setState_invalid_removeEmptyEntry() {
AnalysisTarget target1 = new TestSource('/a.dart');
AnalysisTarget target2 = new TestSource('/b.dart');
« no previous file with comments | « pkg/analyzer/lib/src/context/cache.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698