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

Unified Diff: pkg/analysis_server/test/services/index/store/codec_test.dart

Issue 738673002: Use shorter DartElementLocation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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/analysis_server/test/services/index/store/codec_test.dart
diff --git a/pkg/analysis_server/test/services/index/store/codec_test.dart b/pkg/analysis_server/test/services/index/store/codec_test.dart
index 9903b1f72bf651c8a7cc3fb4db4368768c3dbd8c..34257e30ad1b06f93c221e20a7fefc3a67c81b05 100644
--- a/pkg/analysis_server/test/services/index/store/codec_test.dart
+++ b/pkg/analysis_server/test/services/index/store/codec_test.dart
@@ -19,6 +19,7 @@ main() {
groupSep = ' | ';
runReflectiveTests(_ContextCodecTest);
runReflectiveTests(_ElementCodecTest);
+ runReflectiveTests(_ElementKindCodecTest);
runReflectiveTests(_RelationshipCodecTest);
runReflectiveTests(_StringCodecTest);
}
@@ -146,12 +147,9 @@ main() {
int id = codec.encode(element, false);
expect(codec.decode(context, id), element);
}
- // check strings, "foo" as a single string, no "foo@17" or "bar@35"
- expect(stringCodec.nameToIndex, hasLength(4));
+ // check strings, only source encoding
+ expect(stringCodec.nameToIndex, hasLength(1));
expect(stringCodec.nameToIndex, containsPair('file:///test.dart', 0));
- expect(stringCodec.nameToIndex, containsPair('main', 1));
- expect(stringCodec.nameToIndex, containsPair('foo', 2));
- expect(stringCodec.nameToIndex, containsPair('bar', 3));
}
void test_localVariable() {
@@ -175,11 +173,9 @@ main() {
int id = codec.encode(element, false);
expect(codec.decode(context, id), element);
}
- // check strings, "foo" as a single string, no "foo@21" or "foo@47"
- expect(stringCodec.nameToIndex, hasLength(3));
+ // check strings, only source encoding
+ expect(stringCodec.nameToIndex, hasLength(1));
expect(stringCodec.nameToIndex, containsPair('file:///test.dart', 0));
- expect(stringCodec.nameToIndex, containsPair('main', 1));
- expect(stringCodec.nameToIndex, containsPair('foo', 2));
}
void test_notLocal() {
@@ -193,10 +189,24 @@ main() {
expect(codec.encode(element, false), id);
expect(codec.decode(context, id), element);
// check strings
- expect(stringCodec.nameToIndex, hasLength(3));
+ expect(stringCodec.nameToIndex, hasLength(1));
expect(stringCodec.nameToIndex, containsPair('file:///test.dart', 0));
- expect(stringCodec.nameToIndex, containsPair('main', 1));
- expect(stringCodec.nameToIndex, containsPair('foo', 2));
+ }
+}
+
+
+@ReflectiveTestCase()
+class _ElementKindCodecTest {
+ ElementKindCodec codec = new ElementKindCodec();
+
+ void test_decode_unknown() {
+ expect(codec.decode(1 << 20), isNull);
+ }
+
+ void test_encodeDecode() {
+ int idClass = codec.encode(ElementKind.CLASS);
+ int idMethod = codec.encode(ElementKind.METHOD);
+ expect(idClass, isNot(idMethod));
}
}

Powered by Google App Engine
This is Rietveld 408576698