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

Side by Side Diff: pkg/analysis_server/test/domain_completion_test.dart

Issue 536593002: return correct replacementOffset and replacementLength (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/dart_completion_manager.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.domain.completion; 5 library test.domain.completion;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/constants.dart'; 9 import 'package:analysis_server/src/constants.dart';
10 import 'package:analysis_server/src/domain_completion.dart'; 10 import 'package:analysis_server/src/domain_completion.dart';
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 expect(replacementOffset, equals(completionOffset)); 154 expect(replacementOffset, equals(completionOffset));
155 expect(replacementLength, equals(0)); 155 expect(replacementLength, equals(0));
156 assertHasResult(CompletionSuggestionKind.CLASS, 'Object'); 156 assertHasResult(CompletionSuggestionKind.CLASS, 'Object');
157 assertHasResult(CompletionSuggestionKind.LIBRARY_PREFIX, 'foo'); 157 assertHasResult(CompletionSuggestionKind.LIBRARY_PREFIX, 'foo');
158 assertNoResult('HtmlElement'); 158 assertNoResult('HtmlElement');
159 assertNoResult('test'); 159 assertNoResult('test');
160 }); 160 });
161 } 161 }
162 162
163 test_keyword() { 163 test_keyword() {
164 addTestFile('^'); 164 addTestFile('library A; cl^');
165 return getSuggestions().then((_) { 165 return getSuggestions().then((_) {
166 expect(replacementOffset, equals(completionOffset)); 166 expect(replacementOffset, equals(completionOffset - 2));
167 expect(replacementLength, equals(0)); 167 expect(replacementLength, equals(2));
168 assertHasResult(CompletionSuggestionKind.KEYWORD, 'library');
169 assertHasResult(CompletionSuggestionKind.KEYWORD, 'import'); 168 assertHasResult(CompletionSuggestionKind.KEYWORD, 'import');
170 assertHasResult(CompletionSuggestionKind.KEYWORD, 'class'); 169 assertHasResult(CompletionSuggestionKind.KEYWORD, 'class');
171 }); 170 });
172 } 171 }
173 172
174 test_locals() { 173 test_locals() {
175 addTestFile('class A {var a; x() {var b;^}}'); 174 addTestFile('class A {var a; x() {var b;^}}');
176 return getSuggestions().then((_) { 175 return getSuggestions().then((_) {
177 expect(replacementOffset, equals(completionOffset)); 176 expect(replacementOffset, equals(completionOffset));
178 expect(replacementLength, equals(0)); 177 expect(replacementLength, equals(0));
(...skipping 13 matching lines...) Expand all
192 }); 191 });
193 } 192 }
194 193
195 test_topLevel() { 194 test_topLevel() {
196 addTestFile(''' 195 addTestFile('''
197 typedef foo(); 196 typedef foo();
198 var test = ''; 197 var test = '';
199 main() {tes^t} 198 main() {tes^t}
200 '''); 199 ''');
201 return getSuggestions().then((_) { 200 return getSuggestions().then((_) {
202 // expect(replacementOffset, equals(completionOffset - 3)); 201 expect(replacementOffset, equals(completionOffset - 3));
203 // expect(replacementLength, equals(4)); 202 expect(replacementLength, equals(4));
204 assertHasResult(CompletionSuggestionKind.CLASS, 'Object'); 203 assertHasResult(CompletionSuggestionKind.CLASS, 'Object');
205 assertHasResult(CompletionSuggestionKind.TOP_LEVEL_VARIABLE, 'test'); 204 assertHasResult(CompletionSuggestionKind.TOP_LEVEL_VARIABLE, 'test');
206 assertNoResult('HtmlElement'); 205 assertNoResult('HtmlElement');
207 }); 206 });
208 } 207 }
209 } 208 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/dart_completion_manager.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698