| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'package:analysis_server/src/services/index2/index2.dart'; | 5 import 'package:analysis_server/src/services/index2/index2.dart'; |
| 6 import 'package:analyzer/dart/ast/ast.dart'; | 6 import 'package:analyzer/dart/ast/ast.dart'; |
| 7 import 'package:analyzer/dart/element/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
| 8 import 'package:analyzer/src/generated/source.dart'; | 8 import 'package:analyzer/src/generated/source.dart'; |
| 9 import 'package:analyzer/src/summary/idl.dart'; | 9 import 'package:analyzer/src/summary/idl.dart'; |
| 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 11 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
| 12 | 12 |
| 13 import '../../abstract_single_unit.dart'; | 13 import '../../abstract_single_unit.dart'; |
| 14 import '../../utils.dart'; | 14 import '../../utils.dart'; |
| 15 | 15 |
| 16 main() { | 16 main() { |
| 17 initializeTestEnvironment(); | 17 initializeTestEnvironment(); |
| 18 defineReflectiveTests(Index2Test); | 18 defineReflectiveTests(Index2Test); |
| 19 } | 19 } |
| 20 | 20 |
| 21 @reflectiveTest | 21 @reflectiveTest |
| 22 class Index2Test extends AbstractSingleUnitTest { | 22 class Index2Test extends AbstractSingleUnitTest { |
| 23 Index2 index = createMemoryIndex(); | 23 Index2 index = createMemoryIndex2(); |
| 24 | 24 |
| 25 /** | 25 /** |
| 26 * Return the [Location] with given properties, or fail. | 26 * Return the [Location] with given properties, or fail. |
| 27 */ | 27 */ |
| 28 Location findLocation(List<Location> locations, String libraryUri, | 28 Location findLocation(List<Location> locations, String libraryUri, |
| 29 String unitUri, int offset, int length) { | 29 String unitUri, int offset, int length) { |
| 30 for (Location location in locations) { | 30 for (Location location in locations) { |
| 31 if (location.libraryUri == libraryUri && | 31 if (location.libraryUri == libraryUri && |
| 32 location.unitUri == unitUri && | 32 location.unitUri == unitUri && |
| 33 location.offset == offset && | 33 location.offset == offset && |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 index.indexUnit(testUnit); | 108 index.indexUnit(testUnit); |
| 109 } | 109 } |
| 110 | 110 |
| 111 Source _indexUnit(String path, String code) { | 111 Source _indexUnit(String path, String code) { |
| 112 Source source = addSource(path, code); | 112 Source source = addSource(path, code); |
| 113 CompilationUnit unit = resolveLibraryUnit(source); | 113 CompilationUnit unit = resolveLibraryUnit(source); |
| 114 index.indexUnit(unit); | 114 index.indexUnit(unit); |
| 115 return source; | 115 return source; |
| 116 } | 116 } |
| 117 } | 117 } |
| OLD | NEW |