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

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

Issue 1140943005: Fix for invalidating results of a target being removed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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/cache_test.dart
diff --git a/pkg/analyzer/test/src/context/cache_test.dart b/pkg/analyzer/test/src/context/cache_test.dart
index 57eca5ca6a8a108c20012ffe4585b5d4521dfbdf..7d4b14a38a23fab494a3306a4600aeaebdde3690 100644
--- a/pkg/analyzer/test/src/context/cache_test.dart
+++ b/pkg/analyzer/test/src/context/cache_test.dart
@@ -156,6 +156,25 @@ class AnalysisCacheTest extends AbstractCacheTest {
expect(entry3.getState(result3), CacheState.VALID);
}
+ void test_remove_invalidateResults_sameTarget() {
+ AnalysisTarget target = new TestSource('/a.dart');
+ CacheEntry entry = new CacheEntry(target);
+ cache.put(entry);
+ ResultDescriptor result1 = new ResultDescriptor('result1', -1);
+ ResultDescriptor result2 = new ResultDescriptor('result2', -2);
+ // set results, all of them are VALID
+ entry.setValue(result1, 111, TargetedResult.EMPTY_LIST);
+ entry.setValue(result2, 222, [new TargetedResult(target, result1)]);
+ expect(entry.getState(result1), CacheState.VALID);
+ expect(entry.getState(result2), CacheState.VALID);
+ expect(entry.getValue(result1), 111);
+ expect(entry.getValue(result2), 222);
+ // remove target, invalidate result2
+ cache.remove(target);
+ expect(cache.get(target), isNull);
+ expect(entry.getState(result2), CacheState.INVALID);
+ }
+
void test_size() {
int size = 4;
for (int i = 0; i < size; i++) {
« no previous file with comments | « pkg/analyzer/test/src/context/abstract_context.dart ('k') | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698