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

Unified Diff: pkg/analysis_server/test/index/split_store_test.dart

Issue 347133002: Explicitly remove AnalysisContext from ContextCodec. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix for IDs generation Created 6 years, 6 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/analysis_server/lib/src/index/split_store.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/index/split_store_test.dart
diff --git a/pkg/analysis_server/test/index/split_store_test.dart b/pkg/analysis_server/test/index/split_store_test.dart
index f78a6be5844b47754539554df11c900bf3359c1b..038357d86dfb62ae28ae71dba16763a167f1751c 100644
--- a/pkg/analysis_server/test/index/split_store_test.dart
+++ b/pkg/analysis_server/test/index/split_store_test.dart
@@ -70,14 +70,38 @@ void _assertHasLocation(List<Location> locations, Element element, int offset,
class _ContextCodecTest {
ContextCodec codec = new ContextCodec();
- void test_all() {
+ void test_encode_decode() {
AnalysisContext contextA = new _MockAnalysisContext('contextA');
AnalysisContext contextB = new _MockAnalysisContext('contextB');
int idA = codec.encode(contextA);
int idB = codec.encode(contextB);
+ expect(idA, codec.encode(contextA));
+ expect(idB, codec.encode(contextB));
expect(codec.decode(idA), contextA);
expect(codec.decode(idB), contextB);
}
+
+ void test_remove() {
+ // encode
+ {
+ AnalysisContext context = new _MockAnalysisContext('context');
+ // encode
+ int id = codec.encode(context);
+ expect(id, 0);
+ expect(codec.decode(id), context);
+ // remove
+ codec.remove(context);
+ expect(codec.decode(id), isNull);
+ }
+ // encode again
+ {
+ AnalysisContext context = new _MockAnalysisContext('context');
+ // encode
+ int id = codec.encode(context);
+ expect(id, 1);
+ expect(codec.decode(id), context);
+ }
+ }
}
« no previous file with comments | « pkg/analysis_server/lib/src/index/split_store.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698