Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: pkg/analysis_server/test/search/abstract_search_domain.dart

Issue 1801883002: Remove old index and search implementations. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.search.abstract_search_domain; 5 library test.search.abstract_search_domain;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/plugin/protocol/protocol.dart'; 9 import 'package:analysis_server/plugin/protocol/protocol.dart';
10 import 'package:analysis_server/src/constants.dart'; 10 import 'package:analysis_server/src/constants.dart';
11 import 'package:analysis_server/src/search/search_domain.dart'; 11 import 'package:analysis_server/src/search/search_domain.dart';
12 import 'package:analysis_server/src/services/index/index.dart' show Index; 12 import 'package:analysis_server/src/services/index/index.dart'
13 import 'package:analysis_server/src/services/index/local_memory_index.dart'; 13 show Index, createMemoryIndex;
14 import 'package:unittest/unittest.dart'; 14 import 'package:unittest/unittest.dart';
15 15
16 import '../analysis_abstract.dart'; 16 import '../analysis_abstract.dart';
17 17
18 class AbstractSearchDomainTest extends AbstractAnalysisTest { 18 class AbstractSearchDomainTest extends AbstractAnalysisTest {
19 final Map<String, _ResultSet> resultSets = {}; 19 final Map<String, _ResultSet> resultSets = {};
20 String searchId; 20 String searchId;
21 List<SearchResult> results = <SearchResult>[]; 21 List<SearchResult> results = <SearchResult>[];
22 SearchResult result; 22 SearchResult result;
23 23
24 void assertHasResult(SearchResultKind kind, String search, [int length]) { 24 void assertHasResult(SearchResultKind kind, String search, [int length]) {
25 int offset = findOffset(search); 25 int offset = findOffset(search);
26 if (length == null) { 26 if (length == null) {
27 length = findIdentifierLength(search); 27 length = findIdentifierLength(search);
28 } 28 }
29 findResult(kind, testFile, offset, length, true); 29 findResult(kind, testFile, offset, length, true);
30 } 30 }
31 31
32 void assertNoResult(SearchResultKind kind, String search, [int length]) { 32 void assertNoResult(SearchResultKind kind, String search, [int length]) {
33 int offset = findOffset(search); 33 int offset = findOffset(search);
34 if (length == null) { 34 if (length == null) {
35 length = findIdentifierLength(search); 35 length = findIdentifierLength(search);
36 } 36 }
37 findResult(kind, testFile, offset, length, false); 37 findResult(kind, testFile, offset, length, false);
38 } 38 }
39 39
40 @override 40 @override
41 Index createIndex() { 41 Index createIndex() {
42 return createLocalMemoryIndex(); 42 return createMemoryIndex();
43 } 43 }
44 44
45 void findResult(SearchResultKind kind, String file, int offset, int length, 45 void findResult(SearchResultKind kind, String file, int offset, int length,
46 bool expected) { 46 bool expected) {
47 for (SearchResult result in results) { 47 for (SearchResult result in results) {
48 Location location = result.location; 48 Location location = result.location;
49 if (result.kind == kind && 49 if (result.kind == kind &&
50 location.file == file && 50 location.file == file &&
51 location.offset == offset && 51 location.offset == offset &&
52 location.length == length) { 52 location.length == length) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 } 109 }
110 110
111 class _ResultSet { 111 class _ResultSet {
112 final String id; 112 final String id;
113 final List<SearchResult> results = <SearchResult>[]; 113 final List<SearchResult> results = <SearchResult>[];
114 bool done = false; 114 bool done = false;
115 115
116 _ResultSet(this.id); 116 _ResultSet(this.id);
117 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698