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.services.src.index.local_index; | 5 library test.services.src.index.local_index; |
6 | 6 |
7 import 'package:analysis_server/src/services/index/local_index.dart'; | 7 import 'package:analysis_server/src/services/index/local_index.dart'; |
8 import 'package:analysis_server/src/services/index/local_memory_index.dart'; | 8 import 'package:analysis_server/src/services/index/local_memory_index.dart'; |
9 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/src/generated/ast.dart'; |
10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
11 import 'package:analyzer/src/generated/html.dart'; | 11 import 'package:analyzer/src/generated/html.dart'; |
12 import 'package:analyzer/src/generated/source_io.dart'; | 12 import 'package:analyzer/src/generated/source_io.dart'; |
13 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 13 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
14 import 'package:unittest/unittest.dart'; | 14 import 'package:unittest/unittest.dart'; |
15 | 15 |
16 import '../../abstract_context.dart'; | 16 import '../../abstract_context.dart'; |
| 17 import '../../utils.dart'; |
17 import 'store/single_source_container.dart'; | 18 import 'store/single_source_container.dart'; |
18 | 19 |
19 main() { | 20 main() { |
20 groupSep = ' | '; | 21 initializeTestEnvironment(); |
21 defineReflectiveTests(LocalIndexTest); | 22 defineReflectiveTests(LocalIndexTest); |
22 } | 23 } |
23 | 24 |
24 void _assertElementNames(List<Element> elements, List expected) { | 25 void _assertElementNames(List<Element> elements, List expected) { |
25 expect(_toElementNames(elements), unorderedEquals(expected)); | 26 expect(_toElementNames(elements), unorderedEquals(expected)); |
26 } | 27 } |
27 | 28 |
28 Iterable<String> _toElementNames(List<Element> elements) { | 29 Iterable<String> _toElementNames(List<Element> elements) { |
29 return elements.map((element) => element.name); | 30 return elements.map((element) => element.name); |
30 } | 31 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 Source source = addSource(path, content); | 116 Source source = addSource(path, content); |
116 CompilationUnit dartUnit = resolveLibraryUnit(source); | 117 CompilationUnit dartUnit = resolveLibraryUnit(source); |
117 index.indexUnit(context, dartUnit); | 118 index.indexUnit(context, dartUnit); |
118 return source; | 119 return source; |
119 } | 120 } |
120 | 121 |
121 void _indexTest(String content) { | 122 void _indexTest(String content) { |
122 _indexLibraryUnit('/test.dart', content); | 123 _indexLibraryUnit('/test.dart', content); |
123 } | 124 } |
124 } | 125 } |
OLD | NEW |