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

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

Issue 458073002: rename and improve imported completion computer (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
« no previous file with comments | « no previous file | pkg/analysis_services/lib/src/completion/dart_completion_manager.dart » ('j') | 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 '''); 132 ''');
133 return getSuggestions().then((_) { 133 return getSuggestions().then((_) {
134 expect(replacementOffset, equals(completionOffset)); 134 expect(replacementOffset, equals(completionOffset));
135 expect(replacementLength, equals(0)); 135 expect(replacementLength, equals(0));
136 assertHasResult(CompletionSuggestionKind.CLASS, 'Object'); 136 assertHasResult(CompletionSuggestionKind.CLASS, 'Object');
137 assertHasResult(CompletionSuggestionKind.CLASS, 'HtmlElement'); 137 assertHasResult(CompletionSuggestionKind.CLASS, 'HtmlElement');
138 assertNoResult('test'); 138 assertNoResult('test');
139 }); 139 });
140 } 140 }
141 141
142 test_imports_prefixed() {
143 addTestFile('''
144 import 'dart:html' as foo;
145 main() {^}
146 ''');
147 return getSuggestions().then((_) {
148 expect(replacementOffset, equals(completionOffset));
149 expect(replacementLength, equals(0));
150 assertHasResult(CompletionSuggestionKind.CLASS, 'Object');
151 assertHasResult(CompletionSuggestionKind.LIBRARY_PREFIX, 'foo');
152 assertNoResult('HtmlElement');
153 assertNoResult('test');
154 });
155 }
156
142 test_locals() { 157 test_locals() {
143 addTestFile('class A {var a; x() {var b;^}}'); 158 addTestFile('class A {var a; x() {var b;^}}');
144 return getSuggestions().then((_) { 159 return getSuggestions().then((_) {
145 expect(replacementOffset, equals(completionOffset)); 160 expect(replacementOffset, equals(completionOffset));
146 expect(replacementLength, equals(0)); 161 expect(replacementLength, equals(0));
147 assertHasResult(CompletionSuggestionKind.CLASS, 'A'); 162 assertHasResult(CompletionSuggestionKind.CLASS, 'A');
148 assertHasResult(CompletionSuggestionKind.FIELD, 'a'); 163 assertHasResult(CompletionSuggestionKind.FIELD, 'a');
149 assertHasResult(CompletionSuggestionKind.VARIABLE, 'b'); 164 assertHasResult(CompletionSuggestionKind.VARIABLE, 'b');
150 assertHasResult(CompletionSuggestionKind.METHOD_NAME, 'x'); 165 assertHasResult(CompletionSuggestionKind.METHOD_NAME, 'x');
151 }); 166 });
152 } 167 }
153 168
154 test_topLevel() { 169 test_topLevel() {
155 addTestFile(''' 170 addTestFile('''
156 typedef foo(); 171 typedef foo();
157 var test = ''; 172 var test = '';
158 main() {tes^t} 173 main() {tes^t}
159 '''); 174 ''');
160 return getSuggestions().then((_) { 175 return getSuggestions().then((_) {
161 // expect(replacementOffset, equals(completionOffset - 3)); 176 // expect(replacementOffset, equals(completionOffset - 3));
162 // expect(replacementLength, equals(4)); 177 // expect(replacementLength, equals(4));
163 assertHasResult(CompletionSuggestionKind.CLASS, 'Object'); 178 assertHasResult(CompletionSuggestionKind.CLASS, 'Object');
164 assertHasResult(CompletionSuggestionKind.TOP_LEVEL_VARIABLE, 'test'); 179 assertHasResult(CompletionSuggestionKind.TOP_LEVEL_VARIABLE, 'test');
165 assertNoResult('HtmlElement'); 180 assertNoResult('HtmlElement');
166 }); 181 });
167 } 182 }
168 } 183 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_services/lib/src/completion/dart_completion_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698