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

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

Issue 2963773003: Remove the old index. (Closed)
Patch Set: Created 3 years, 5 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:analysis_server/protocol/protocol.dart'; 7 import 'package:analysis_server/protocol/protocol.dart';
8 import 'package:analysis_server/protocol/protocol_constants.dart'; 8 import 'package:analysis_server/protocol/protocol_constants.dart';
9 import 'package:analysis_server/protocol/protocol_generated.dart'; 9 import 'package:analysis_server/protocol/protocol_generated.dart';
10 import 'package:analysis_server/src/search/search_domain.dart'; 10 import 'package:analysis_server/src/search/search_domain.dart';
11 import 'package:analysis_server/src/services/index/index.dart'
12 show Index, createMemoryIndex;
13 import 'package:analyzer_plugin/protocol/protocol_common.dart'; 11 import 'package:analyzer_plugin/protocol/protocol_common.dart';
14 import 'package:test/test.dart'; 12 import 'package:test/test.dart';
15 13
16 import '../analysis_abstract.dart'; 14 import '../analysis_abstract.dart';
17 15
18 class AbstractSearchDomainTest extends AbstractAnalysisTest { 16 class AbstractSearchDomainTest extends AbstractAnalysisTest {
19 final Map<String, _ResultSet> resultSets = {}; 17 final Map<String, _ResultSet> resultSets = {};
20 String searchId; 18 String searchId;
21 List<SearchResult> results = <SearchResult>[]; 19 List<SearchResult> results = <SearchResult>[];
22 SearchResult result; 20 SearchResult result;
23 21
24 void assertHasResult(SearchResultKind kind, String search, [int length]) { 22 void assertHasResult(SearchResultKind kind, String search, [int length]) {
25 int offset = findOffset(search); 23 int offset = findOffset(search);
26 if (length == null) { 24 if (length == null) {
27 length = findIdentifierLength(search); 25 length = findIdentifierLength(search);
28 } 26 }
29 findResult(kind, testFile, offset, length, true); 27 findResult(kind, testFile, offset, length, true);
30 } 28 }
31 29
32 void assertNoResult(SearchResultKind kind, String search, [int length]) { 30 void assertNoResult(SearchResultKind kind, String search, [int length]) {
33 int offset = findOffset(search); 31 int offset = findOffset(search);
34 if (length == null) { 32 if (length == null) {
35 length = findIdentifierLength(search); 33 length = findIdentifierLength(search);
36 } 34 }
37 findResult(kind, testFile, offset, length, false); 35 findResult(kind, testFile, offset, length, false);
38 } 36 }
39 37
40 @override
41 Index createIndex() {
42 return createMemoryIndex();
43 }
44
45 void findResult(SearchResultKind kind, String file, int offset, int length, 38 void findResult(SearchResultKind kind, String file, int offset, int length,
46 bool expected) { 39 bool expected) {
47 for (SearchResult result in results) { 40 for (SearchResult result in results) {
48 Location location = result.location; 41 Location location = result.location;
49 if (result.kind == kind && 42 if (result.kind == kind &&
50 location.file == file && 43 location.file == file &&
51 location.offset == offset && 44 location.offset == offset &&
52 location.length == length) { 45 location.length == length) {
53 if (!expected) { 46 if (!expected) {
54 fail('Unexpected result $result in\n' + results.join('\n')); 47 fail('Unexpected result $result in\n' + results.join('\n'));
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 104 }
112 } 105 }
113 106
114 class _ResultSet { 107 class _ResultSet {
115 final String id; 108 final String id;
116 final List<SearchResult> results = <SearchResult>[]; 109 final List<SearchResult> results = <SearchResult>[];
117 bool done = false; 110 bool done = false;
118 111
119 _ResultSet(this.id); 112 _ResultSet(this.id);
120 } 113 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/edit/refactoring_test.dart ('k') | pkg/analysis_server/test/search/type_hierarchy_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698