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

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

Issue 461063002: add keyword suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 4 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
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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 return getSuggestions().then((_) { 158 return getSuggestions().then((_) {
159 expect(replacementOffset, equals(completionOffset)); 159 expect(replacementOffset, equals(completionOffset));
160 expect(replacementLength, equals(0)); 160 expect(replacementLength, equals(0));
161 assertHasResult(CompletionSuggestionKind.CLASS, 'Object'); 161 assertHasResult(CompletionSuggestionKind.CLASS, 'Object');
162 assertHasResult(CompletionSuggestionKind.LIBRARY_PREFIX, 'foo'); 162 assertHasResult(CompletionSuggestionKind.LIBRARY_PREFIX, 'foo');
163 assertNoResult('HtmlElement'); 163 assertNoResult('HtmlElement');
164 assertNoResult('test'); 164 assertNoResult('test');
165 }); 165 });
166 } 166 }
167 167
168 test_keyword() {
169 addTestFile('^');
170 return getSuggestions().then((_) {
171 expect(replacementOffset, equals(completionOffset));
172 expect(replacementLength, equals(0));
173 assertHasResult(CompletionSuggestionKind.KEYWORD, 'library');
174 assertHasResult(CompletionSuggestionKind.KEYWORD, 'import');
175 assertHasResult(CompletionSuggestionKind.KEYWORD, 'class');
176 });
177 }
178
168 test_locals() { 179 test_locals() {
169 addTestFile('class A {var a; x() {var b;^}}'); 180 addTestFile('class A {var a; x() {var b;^}}');
170 return getSuggestions().then((_) { 181 return getSuggestions().then((_) {
171 expect(replacementOffset, equals(completionOffset)); 182 expect(replacementOffset, equals(completionOffset));
172 expect(replacementLength, equals(0)); 183 expect(replacementLength, equals(0));
173 assertHasResult(CompletionSuggestionKind.CLASS, 'A'); 184 assertHasResult(CompletionSuggestionKind.CLASS, 'A');
174 assertHasResult(CompletionSuggestionKind.FIELD, 'a'); 185 assertHasResult(CompletionSuggestionKind.FIELD, 'a');
175 assertHasResult(CompletionSuggestionKind.LOCAL_VARIABLE, 'b'); 186 assertHasResult(CompletionSuggestionKind.LOCAL_VARIABLE, 'b');
176 assertHasResult(CompletionSuggestionKind.METHOD_NAME, 'x'); 187 assertHasResult(CompletionSuggestionKind.METHOD_NAME, 'x');
177 }); 188 });
(...skipping 16 matching lines...) Expand all
194 '''); 205 ''');
195 return getSuggestions().then((_) { 206 return getSuggestions().then((_) {
196 // expect(replacementOffset, equals(completionOffset - 3)); 207 // expect(replacementOffset, equals(completionOffset - 3));
197 // expect(replacementLength, equals(4)); 208 // expect(replacementLength, equals(4));
198 assertHasResult(CompletionSuggestionKind.CLASS, 'Object'); 209 assertHasResult(CompletionSuggestionKind.CLASS, 'Object');
199 assertHasResult(CompletionSuggestionKind.TOP_LEVEL_VARIABLE, 'test'); 210 assertHasResult(CompletionSuggestionKind.TOP_LEVEL_VARIABLE, 'test');
200 assertNoResult('HtmlElement'); 211 assertNoResult('HtmlElement');
201 }); 212 });
202 } 213 }
203 } 214 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/doc/api.html ('k') | pkg/analysis_server/test/integration/protocol_matchers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698