OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library test.index.store.codec; | 5 library test.engine.src.index.store.codec; |
6 | 6 |
7 import 'package:analysis_server/src/index/store/codec.dart'; | 7 import 'package:analyzer/index/index.dart'; |
8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
10 import 'package:analyzer/src/generated/index.dart'; | 10 import 'package:analyzer/src/index/store/codec.dart'; |
11 import 'package:typed_mock/typed_mock.dart'; | 11 import 'package:typed_mock/typed_mock.dart'; |
12 import 'package:unittest/unittest.dart'; | 12 import 'package:unittest/unittest.dart'; |
13 | 13 |
14 import '../../reflective_tests.dart'; | 14 import '../../reflective_tests.dart'; |
15 import 'typed_mocks.dart'; | 15 import 'typed_mocks.dart'; |
16 | 16 |
17 | 17 |
18 main() { | 18 main() { |
19 groupSep = ' | '; | 19 groupSep = ' | '; |
20 group('ContextCodec', () { | 20 group('ContextCodec', () { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // check strings | 143 // check strings |
144 expect(stringCodec.nameToIndex, hasLength(2)); | 144 expect(stringCodec.nameToIndex, hasLength(2)); |
145 expect(stringCodec.nameToIndex, containsPair('foo', 0)); | 145 expect(stringCodec.nameToIndex, containsPair('foo', 0)); |
146 expect(stringCodec.nameToIndex, containsPair('bar', 1)); | 146 expect(stringCodec.nameToIndex, containsPair('bar', 1)); |
147 } | 147 } |
148 } | 148 } |
149 | 149 |
150 | 150 |
151 @ReflectiveTestCase() | 151 @ReflectiveTestCase() |
152 class _RelationshipCodecTest { | 152 class _RelationshipCodecTest { |
| 153 StringCodec stringCodec = new StringCodec(); |
153 RelationshipCodec codec; | 154 RelationshipCodec codec; |
154 StringCodec stringCodec = new StringCodec(); | |
155 | 155 |
156 void setUp() { | 156 void setUp() { |
157 codec = new RelationshipCodec(stringCodec); | 157 codec = new RelationshipCodec(stringCodec); |
158 } | 158 } |
159 | 159 |
160 void test_all() { | 160 void test_all() { |
161 Relationship relationship = Relationship.getRelationship('my-relationship'); | 161 Relationship relationship = Relationship.getRelationship('my-relationship'); |
162 int id = codec.encode(relationship); | 162 int id = codec.encode(relationship); |
163 expect(codec.decode(id), relationship); | 163 expect(codec.decode(id), relationship); |
164 } | 164 } |
165 } | 165 } |
166 | 166 |
167 | 167 |
168 @ReflectiveTestCase() | 168 @ReflectiveTestCase() |
169 class _StringCodecTest { | 169 class _StringCodecTest { |
170 StringCodec codec = new StringCodec(); | 170 StringCodec codec = new StringCodec(); |
171 | 171 |
172 void test_all() { | 172 void test_all() { |
173 int idA = codec.encode('aaa'); | 173 int idA = codec.encode('aaa'); |
174 int idB = codec.encode('bbb'); | 174 int idB = codec.encode('bbb'); |
175 expect(codec.decode(idA), 'aaa'); | 175 expect(codec.decode(idA), 'aaa'); |
176 expect(codec.decode(idB), 'bbb'); | 176 expect(codec.decode(idB), 'bbb'); |
177 } | 177 } |
178 } | 178 } |
OLD | NEW |