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

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

Issue 1139643004: Add AnalysisCache.getState() and getValue(). (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
« no previous file with comments | « pkg/analyzer/lib/src/task/dart_work_manager.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 6a1c3c154f137793ff8b3fa9be385c675998b57e..57eca5ca6a8a108c20012ffe4585b5d4521dfbdf 100644
--- a/pkg/analyzer/test/src/context/cache_test.dart
+++ b/pkg/analyzer/test/src/context/cache_test.dart
@@ -67,6 +67,45 @@ class AnalysisCacheTest extends AbstractCacheTest {
expect(cache.getContextFor(target), context);
}
+ void test_getState_hasEntry_flushed() {
+ ResultDescriptor result = new ResultDescriptor('result', -1);
+ AnalysisTarget target = new TestSource();
+ CacheEntry entry = new CacheEntry(target);
+ cache.put(entry);
+ entry.setState(result, CacheState.FLUSHED);
+ expect(cache.getState(target, result), CacheState.FLUSHED);
+ }
+
+ void test_getState_hasEntry_valid() {
+ ResultDescriptor result = new ResultDescriptor('result', -1);
+ AnalysisTarget target = new TestSource();
+ CacheEntry entry = new CacheEntry(target);
+ cache.put(entry);
+ entry.setValue(result, '', []);
+ expect(cache.getState(target, result), CacheState.VALID);
+ }
+
+ void test_getState_noEntry() {
+ ResultDescriptor result = new ResultDescriptor('result', -1);
+ AnalysisTarget target = new TestSource();
+ expect(cache.getState(target, result), CacheState.INVALID);
+ }
+
+ void test_getValue_hasEntry_valid() {
+ ResultDescriptor result = new ResultDescriptor('result', -1);
+ AnalysisTarget target = new TestSource();
+ CacheEntry entry = new CacheEntry(target);
+ cache.put(entry);
+ entry.setValue(result, 111, []);
+ expect(cache.getValue(target, result), 111);
+ }
+
+ void test_getValue_noEntry() {
+ ResultDescriptor result = new ResultDescriptor('result', -1);
+ AnalysisTarget target = new TestSource();
+ expect(cache.getValue(target, result), -1);
+ }
+
void test_iterator() {
AnalysisTarget target = new TestSource();
CacheEntry entry = new CacheEntry(target);
« no previous file with comments | « pkg/analyzer/lib/src/task/dart_work_manager.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698