| 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 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/services/index/index.dart'; | 7 import 'package:analysis_server/src/services/index/index.dart'; |
| 8 import 'package:analyzer/dart/ast/ast.dart'; | 8 import 'package:analyzer/dart/ast/ast.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/src/generated/source.dart'; | 10 import 'package:analyzer/src/generated/source.dart'; |
| 11 import 'package:analyzer/src/summary/idl.dart'; | 11 import 'package:analyzer/src/summary/idl.dart'; |
| 12 import 'package:test/test.dart'; | 12 import 'package:test/test.dart'; |
| 13 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 13 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 14 import 'package:typed_mock/typed_mock.dart'; | 14 import 'package:typed_mock/typed_mock.dart'; |
| 15 | 15 |
| 16 import '../../abstract_single_unit.dart'; | 16 import '../../abstract_single_unit.dart'; |
| 17 | 17 |
| 18 main() { | 18 main() { |
| 19 defineReflectiveSuite(() { | 19 defineReflectiveSuite(() { |
| 20 defineReflectiveTests(IndexTest); | 20 defineReflectiveTests(IndexTest); |
| 21 }); | 21 }); |
| 22 } | 22 } |
| 23 | 23 |
| 24 @reflectiveTest | 24 @reflectiveTest |
| 25 class IndexTest extends AbstractSingleUnitTest { | 25 class IndexTest extends AbstractSingleUnitTest { |
| 26 Index index = createMemoryIndex(); | 26 Index index = createMemoryIndex(); |
| 27 | 27 |
| 28 @override |
| 29 bool get enableNewAnalysisDriver => false; |
| 30 |
| 28 /** | 31 /** |
| 29 * Return the [Location] with given properties, or fail. | 32 * Return the [Location] with given properties, or fail. |
| 30 */ | 33 */ |
| 31 Location findLocation(List<Location> locations, String libraryUri, | 34 Location findLocation(List<Location> locations, String libraryUri, |
| 32 String unitUri, int offset, int length, bool isQualified) { | 35 String unitUri, int offset, int length, bool isQualified) { |
| 33 for (Location location in locations) { | 36 for (Location location in locations) { |
| 34 if (location.libraryUri == libraryUri && | 37 if (location.libraryUri == libraryUri && |
| 35 location.unitUri == unitUri && | 38 location.unitUri == unitUri && |
| 36 location.offset == offset && | 39 location.offset == offset && |
| 37 location.length == length && | 40 location.length == length && |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 Future<Source> _indexUnit(String path, String code) async { | 373 Future<Source> _indexUnit(String path, String code) async { |
| 371 Source source = addSource(path, code); | 374 Source source = addSource(path, code); |
| 372 CompilationUnit unit = await resolveLibraryUnit(source); | 375 CompilationUnit unit = await resolveLibraryUnit(source); |
| 373 index.indexUnit(unit); | 376 index.indexUnit(unit); |
| 374 return source; | 377 return source; |
| 375 } | 378 } |
| 376 } | 379 } |
| 377 | 380 |
| 378 class _CompilationUnitElementMock extends TypedMock | 381 class _CompilationUnitElementMock extends TypedMock |
| 379 implements CompilationUnitElement {} | 382 implements CompilationUnitElement {} |
| OLD | NEW |