| 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/index/index.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(IndexTest); |
| 19 } | 19 } |
| 20 | 20 |
| 21 @reflectiveTest | 21 @reflectiveTest |
| 22 class Index2Test extends AbstractSingleUnitTest { | 22 class IndexTest extends AbstractSingleUnitTest { |
| 23 Index2 index = createMemoryIndex2(); | 23 Index index = createMemoryIndex(); |
| 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, bool isQualified) { | 29 String unitUri, int offset, int length, bool isQualified) { |
| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 index.indexUnit(testUnit); | 303 index.indexUnit(testUnit); |
| 304 } | 304 } |
| 305 | 305 |
| 306 Source _indexUnit(String path, String code) { | 306 Source _indexUnit(String path, String code) { |
| 307 Source source = addSource(path, code); | 307 Source source = addSource(path, code); |
| 308 CompilationUnit unit = resolveLibraryUnit(source); | 308 CompilationUnit unit = resolveLibraryUnit(source); |
| 309 index.indexUnit(unit); | 309 index.indexUnit(unit); |
| 310 return source; | 310 return source; |
| 311 } | 311 } |
| 312 } | 312 } |
| OLD | NEW |