| 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_reflective_loader/test_reflective_loader.dart'; | 17 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 17 import 'package:unittest/unittest.dart'; | |
| 18 | 18 |
| 19 import '../../abstract_single_unit.dart'; | 19 import '../../abstract_single_unit.dart'; |
| 20 import '../../utils.dart'; | 20 import '../../utils.dart'; |
| 21 | 21 |
| 22 main() { | 22 main() { |
| 23 initializeTestEnvironment(); | 23 initializeTestEnvironment(); |
| 24 defineReflectiveTests(SearchEngineImplTest); | 24 defineReflectiveSuite(() { |
| 25 defineReflectiveTests(SearchEngineImplTest); |
| 26 }); |
| 25 } | 27 } |
| 26 | 28 |
| 27 class ExpectedMatch { | 29 class ExpectedMatch { |
| 28 final Element element; | 30 final Element element; |
| 29 final MatchKind kind; | 31 final MatchKind kind; |
| 30 SourceRange range; | 32 SourceRange range; |
| 31 final bool isResolved; | 33 final bool isResolved; |
| 32 final bool isQualified; | 34 final bool isQualified; |
| 33 | 35 |
| 34 ExpectedMatch(this.element, this.kind, int offset, int length, | 36 ExpectedMatch(this.element, this.kind, int offset, int length, |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 List<SearchMatch> matches = await searchEngine.searchReferences(element); | 930 List<SearchMatch> matches = await searchEngine.searchReferences(element); |
| 929 _assertMatches(matches, expectedMatches); | 931 _assertMatches(matches, expectedMatches); |
| 930 expect(matches, hasLength(expectedMatches.length)); | 932 expect(matches, hasLength(expectedMatches.length)); |
| 931 } | 933 } |
| 932 | 934 |
| 933 static void _assertMatches( | 935 static void _assertMatches( |
| 934 List<SearchMatch> matches, List<ExpectedMatch> expectedMatches) { | 936 List<SearchMatch> matches, List<ExpectedMatch> expectedMatches) { |
| 935 expect(matches, unorderedEquals(expectedMatches)); | 937 expect(matches, unorderedEquals(expectedMatches)); |
| 936 } | 938 } |
| 937 } | 939 } |
| OLD | NEW |