| 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.engine.src.index.split_store; | 5 library test.engine.src.index.split_store; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_testing/mocks.dart'; |
| 10 import 'package:analysis_testing/reflective_tests.dart'; |
| 11 import 'package:analyzer/index/index.dart'; |
| 9 import 'package:analyzer/src/generated/element.dart'; | 12 import 'package:analyzer/src/generated/element.dart'; |
| 10 import 'package:analyzer/src/generated/engine.dart'; | 13 import 'package:analyzer/src/generated/engine.dart'; |
| 11 import 'package:analyzer/src/generated/source.dart'; | 14 import 'package:analyzer/src/generated/source.dart'; |
| 15 import 'package:analyzer/src/index/store/codec.dart'; |
| 16 import 'package:analyzer/src/index/store/memory_node_manager.dart'; |
| 17 import 'package:analyzer/src/index/store/split_store.dart'; |
| 12 import 'package:typed_mock/typed_mock.dart'; | 18 import 'package:typed_mock/typed_mock.dart'; |
| 13 import 'package:unittest/unittest.dart'; | 19 import 'package:unittest/unittest.dart'; |
| 14 | 20 |
| 15 import '../../reflective_tests.dart'; | 21 import 'mocks.dart'; |
| 16 import 'single_source_container.dart'; | 22 import 'single_source_container.dart'; |
| 17 import 'typed_mocks.dart'; | |
| 18 import 'package:analyzer/src/index/store/split_store.dart'; | |
| 19 import 'package:analyzer/index/index.dart'; | |
| 20 import 'package:analyzer/src/index/store/codec.dart'; | |
| 21 import 'package:analyzer/src/index/store/memory_node_manager.dart'; | |
| 22 | 23 |
| 23 | 24 |
| 24 main() { | 25 main() { |
| 25 groupSep = ' | '; | 26 groupSep = ' | '; |
| 26 group('FileNodeManager', () { | 27 group('FileNodeManager', () { |
| 27 runReflectiveTests(_FileNodeManagerTest); | 28 runReflectiveTests(_FileNodeManagerTest); |
| 28 }); | 29 }); |
| 29 group('IndexNode', () { | 30 group('IndexNode', () { |
| 30 runReflectiveTests(_IndexNodeTest); | 31 runReflectiveTests(_IndexNodeTest); |
| 31 }); | 32 }); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 49 return; | 50 return; |
| 50 } | 51 } |
| 51 } | 52 } |
| 52 fail('Expected to find Location' | 53 fail('Expected to find Location' |
| 53 '(element=$element, offset=$offset, length=$length)'); | 54 '(element=$element, offset=$offset, length=$length)'); |
| 54 } | 55 } |
| 55 | 56 |
| 56 | 57 |
| 57 @ReflectiveTestCase() | 58 @ReflectiveTestCase() |
| 58 class _FileNodeManagerTest { | 59 class _FileNodeManagerTest { |
| 60 MockLogger logger = new MockLogger(); |
| 61 StringCodec stringCodec = new StringCodec(); |
| 62 RelationshipCodec relationshipCodec; |
| 63 |
| 59 AnalysisContext context = new MockAnalysisContext('context'); | 64 AnalysisContext context = new MockAnalysisContext('context'); |
| 60 ContextCodec contextCodec = new MockContextCodec(); | 65 ContextCodec contextCodec = new MockContextCodec(); |
| 61 int contextId = 13; | 66 int contextId = 13; |
| 67 |
| 62 ElementCodec elementCodec = new MockElementCodec(); | 68 ElementCodec elementCodec = new MockElementCodec(); |
| 69 int nextElementId = 0; |
| 70 |
| 71 FileNodeManager nodeManager; |
| 63 FileManager fileManager = new _MockFileManager(); | 72 FileManager fileManager = new _MockFileManager(); |
| 64 MockLogger logger = new MockLogger(); | |
| 65 int nextElementId = 0; | |
| 66 FileNodeManager nodeManager; | |
| 67 RelationshipCodec relationshipCodec; | |
| 68 StringCodec stringCodec = new StringCodec(); | |
| 69 | 73 |
| 70 void setUp() { | 74 void setUp() { |
| 71 relationshipCodec = new RelationshipCodec(stringCodec); | 75 relationshipCodec = new RelationshipCodec(stringCodec); |
| 72 nodeManager = new FileNodeManager(fileManager, logger, stringCodec, | 76 nodeManager = new FileNodeManager(fileManager, logger, stringCodec, |
| 73 contextCodec, elementCodec, relationshipCodec); | 77 contextCodec, elementCodec, relationshipCodec); |
| 74 when(contextCodec.encode(context)).thenReturn(contextId); | 78 when(contextCodec.encode(context)).thenReturn(contextId); |
| 75 when(contextCodec.decode(contextId)).thenReturn(context); | 79 when(contextCodec.decode(contextId)).thenReturn(context); |
| 76 } | 80 } |
| 77 | 81 |
| 78 void test_clear() { | 82 void test_clear() { |
| (...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 * Wraps the given locations into [LocationEqualsWrapper]. | 1061 * Wraps the given locations into [LocationEqualsWrapper]. |
| 1058 */ | 1062 */ |
| 1059 static List<_LocationEqualsWrapper> wrapLocations(List<Location> locations) { | 1063 static List<_LocationEqualsWrapper> wrapLocations(List<Location> locations) { |
| 1060 List<_LocationEqualsWrapper> wrappers = <_LocationEqualsWrapper>[]; | 1064 List<_LocationEqualsWrapper> wrappers = <_LocationEqualsWrapper>[]; |
| 1061 for (Location location in locations) { | 1065 for (Location location in locations) { |
| 1062 wrappers.add(new _LocationEqualsWrapper(location)); | 1066 wrappers.add(new _LocationEqualsWrapper(location)); |
| 1063 } | 1067 } |
| 1064 return wrappers; | 1068 return wrappers; |
| 1065 } | 1069 } |
| 1066 } | 1070 } |
| OLD | NEW |