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.search.search_engine_internal; | 5 library test.services.src.search.search_engine_internal; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/src/services/index/index.dart'; | 9 import 'package:analysis_server/src/services/index/index.dart'; |
10 import 'package:analysis_server/src/services/search/search_engine.dart'; | 10 import 'package:analysis_server/src/services/search/search_engine.dart'; |
11 import 'package:analysis_server/src/services/search/search_engine_internal.dart'
; | 11 import 'package:analysis_server/src/services/search/search_engine_internal.dart'
; |
12 import 'package:analyzer/dart/element/element.dart'; | 12 import 'package:analyzer/dart/element/element.dart'; |
13 import 'package:analyzer/src/dart/element/element.dart'; | 13 import 'package:analyzer/src/dart/element/element.dart'; |
14 import 'package:analyzer/src/dart/element/member.dart'; | 14 import 'package:analyzer/src/dart/element/member.dart'; |
15 import 'package:analyzer/src/generated/source.dart'; | 15 import 'package:analyzer/src/generated/source.dart'; |
16 import 'package:test/test.dart'; | 16 import 'package:test/test.dart'; |
17 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 17 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
18 | 18 |
19 import '../../abstract_single_unit.dart'; | 19 import '../../abstract_single_unit.dart'; |
20 import '../../utils.dart'; | |
21 | 20 |
22 main() { | 21 main() { |
23 initializeTestEnvironment(); | |
24 defineReflectiveSuite(() { | 22 defineReflectiveSuite(() { |
25 defineReflectiveTests(SearchEngineImplTest); | 23 defineReflectiveTests(SearchEngineImplTest); |
26 }); | 24 }); |
27 } | 25 } |
28 | 26 |
29 class ExpectedMatch { | 27 class ExpectedMatch { |
30 final Element element; | 28 final Element element; |
31 final MatchKind kind; | 29 final MatchKind kind; |
32 SourceRange range; | 30 SourceRange range; |
33 final bool isResolved; | 31 final bool isResolved; |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 List<SearchMatch> matches = await searchEngine.searchReferences(element); | 928 List<SearchMatch> matches = await searchEngine.searchReferences(element); |
931 _assertMatches(matches, expectedMatches); | 929 _assertMatches(matches, expectedMatches); |
932 expect(matches, hasLength(expectedMatches.length)); | 930 expect(matches, hasLength(expectedMatches.length)); |
933 } | 931 } |
934 | 932 |
935 static void _assertMatches( | 933 static void _assertMatches( |
936 List<SearchMatch> matches, List<ExpectedMatch> expectedMatches) { | 934 List<SearchMatch> matches, List<ExpectedMatch> expectedMatches) { |
937 expect(matches, unorderedEquals(expectedMatches)); | 935 expect(matches, unorderedEquals(expectedMatches)); |
938 } | 936 } |
939 } | 937 } |
OLD | NEW |