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; | 5 library test.services.src.search.search_engine; |
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/index/local_memory_index.dart'; | 10 import 'package:analysis_server/src/services/index/local_memory_index.dart'; |
11 import 'package:analysis_server/src/services/search/search_engine.dart'; | 11 import 'package:analysis_server/src/services/search/search_engine.dart'; |
12 import 'package:analysis_server/src/services/search/search_engine_internal.dart'
; | 12 import 'package:analysis_server/src/services/search/search_engine_internal.dart'
; |
13 import 'package:analyzer/dart/element/element.dart'; | 13 import 'package:analyzer/dart/element/element.dart'; |
14 import 'package:analyzer/src/dart/element/element.dart'; | 14 import 'package:analyzer/src/dart/element/element.dart'; |
15 import 'package:analyzer/src/dart/element/member.dart'; | 15 import 'package:analyzer/src/dart/element/member.dart'; |
16 import 'package:analyzer/src/generated/source.dart'; | 16 import 'package:analyzer/src/generated/source.dart'; |
17 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 17 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
18 import 'package:typed_mock/typed_mock.dart'; | |
19 import 'package:unittest/unittest.dart'; | 18 import 'package:unittest/unittest.dart'; |
20 | 19 |
21 import '../../abstract_single_unit.dart'; | 20 import '../../abstract_single_unit.dart'; |
22 import '../../utils.dart'; | 21 import '../../utils.dart'; |
23 | 22 |
24 main() { | 23 main() { |
25 initializeTestEnvironment(); | 24 initializeTestEnvironment(); |
26 defineReflectiveTests(SearchEngineImplTest); | 25 defineReflectiveTests(SearchEngineImplTest); |
27 } | 26 } |
28 | 27 |
(...skipping 28 matching lines...) Expand all Loading... |
57 buffer.write(range); | 56 buffer.write(range); |
58 buffer.write(", isResolved="); | 57 buffer.write(", isResolved="); |
59 buffer.write(isResolved); | 58 buffer.write(isResolved); |
60 buffer.write(", isQualified="); | 59 buffer.write(", isQualified="); |
61 buffer.write(isQualified); | 60 buffer.write(isQualified); |
62 buffer.write(")"); | 61 buffer.write(")"); |
63 return buffer.toString(); | 62 return buffer.toString(); |
64 } | 63 } |
65 } | 64 } |
66 | 65 |
67 class MockIndex extends TypedMock implements Index {} | |
68 | |
69 @reflectiveTest | 66 @reflectiveTest |
70 class SearchEngineImplTest extends AbstractSingleUnitTest { | 67 class SearchEngineImplTest extends AbstractSingleUnitTest { |
71 Index index; | 68 Index index; |
72 SearchEngineImpl searchEngine; | 69 SearchEngineImpl searchEngine; |
73 | 70 |
74 void setUp() { | 71 void setUp() { |
75 super.setUp(); | 72 super.setUp(); |
76 index = createLocalMemoryIndex(); | 73 index = createLocalMemoryIndex(); |
77 searchEngine = new SearchEngineImpl(index); | 74 searchEngine = new SearchEngineImpl(index); |
78 } | 75 } |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 .then((List<SearchMatch> matches) { | 665 .then((List<SearchMatch> matches) { |
669 _assertMatches(matches, expectedMatches); | 666 _assertMatches(matches, expectedMatches); |
670 }); | 667 }); |
671 } | 668 } |
672 | 669 |
673 static void _assertMatches( | 670 static void _assertMatches( |
674 List<SearchMatch> matches, List<ExpectedMatch> expectedMatches) { | 671 List<SearchMatch> matches, List<ExpectedMatch> expectedMatches) { |
675 expect(matches, unorderedEquals(expectedMatches)); | 672 expect(matches, unorderedEquals(expectedMatches)); |
676 } | 673 } |
677 } | 674 } |
OLD | NEW |