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

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

Issue 1165573002: Verify that new task manager invalidation code handles cycles. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
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
« no previous file with comments | « no previous file | 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 80f81667fe1c49e700a729342fc85a75b6035a0e..cd28a4245e5ad4041a0818583b630a85be987025 100644
--- a/pkg/analyzer/test/src/context/cache_test.dart
+++ b/pkg/analyzer/test/src/context/cache_test.dart
@@ -497,6 +497,26 @@ class CacheEntryTest extends AbstractCacheTest {
expect(entry.getValue(result), 1);
}
+ test_setState_invalid_dependencyCycle() {
+ AnalysisTarget target1 = new TestSource('/a.dart');
+ AnalysisTarget target2 = new TestSource('/b.dart');
+ CacheEntry entry1 = new CacheEntry(target1);
+ CacheEntry entry2 = new CacheEntry(target2);
+ cache.put(entry1);
+ cache.put(entry2);
+ ResultDescriptor result = new ResultDescriptor('result', -1);
+ // Set each result as VALID with a dependency on on the other.
+ entry1.setValue(result, 100, [new TargetedResult(target2, result)]);
+ entry2.setValue(result, 200, [new TargetedResult(target1, result)]);
+ expect(entry1.getState(result), CacheState.VALID);
+ expect(entry2.getState(result), CacheState.VALID);
+ // Invalidate entry1.result; this should cause entry2 to be also
+ // cleared without going into an infinite regress.
+ entry1.setState(result, CacheState.INVALID);
+ expect(cache.get(target1), isNull);
+ expect(cache.get(target2), isNull);
+ }
+
test_setState_invalid_invalidateDependent() {
AnalysisTarget target = new TestSource();
CacheEntry entry = new CacheEntry(target);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698