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

Side by Side Diff: pkg/analysis_server/test/services/completion/dart/uri_contributor_test.dart

Issue 2342473002: improve import URI completions at EOF (Closed)
Patch Set: update tests Created 4 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
« no previous file with comments | « pkg/analysis_server/test/completion_test.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.services.completion.contributor.dart.importuri; 5 library test.services.completion.contributor.dart.importuri;
6 6
7 import 'package:analysis_server/plugin/protocol/protocol.dart'; 7 import 'package:analysis_server/plugin/protocol/protocol.dart';
8 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart'; 8 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart';
9 import 'package:analysis_server/src/services/completion/dart/uri_contributor.dar t'; 9 import 'package:analysis_server/src/services/completion/dart/uri_contributor.dar t';
10 import 'package:analyzer/file_system/memory_file_system.dart'; 10 import 'package:analyzer/file_system/memory_file_system.dart';
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 test_import2() async { 90 test_import2() async {
91 addTestSource('import "^" import'); 91 addTestSource('import "^" import');
92 await computeSuggestions(); 92 await computeSuggestions();
93 expect(replacementOffset, completionOffset); 93 expect(replacementOffset, completionOffset);
94 expect(replacementLength, 0); 94 expect(replacementLength, 0);
95 assertSuggest('dart:', csKind: CompletionSuggestionKind.IMPORT); 95 assertSuggest('dart:', csKind: CompletionSuggestionKind.IMPORT);
96 assertSuggest('package:', csKind: CompletionSuggestionKind.IMPORT); 96 assertSuggest('package:', csKind: CompletionSuggestionKind.IMPORT);
97 } 97 }
98 98
99 test_import3() async {
100 addTestSource('import "^ import');
101 await computeSuggestions();
102 expect(replacementOffset, completionOffset);
103 expect(replacementLength, 7);
104 assertSuggest('dart:', csKind: CompletionSuggestionKind.IMPORT);
105 assertSuggest('package:', csKind: CompletionSuggestionKind.IMPORT);
106 }
107
99 test_import_dart() async { 108 test_import_dart() async {
100 addTestSource('import "d^" import'); 109 addTestSource('import "d^" import');
101 await computeSuggestions(); 110 await computeSuggestions();
102 expect(replacementOffset, completionOffset - 1); 111 expect(replacementOffset, completionOffset - 1);
103 expect(replacementLength, 1); 112 expect(replacementLength, 1);
104 assertSuggest('dart:', csKind: CompletionSuggestionKind.IMPORT); 113 assertSuggest('dart:', csKind: CompletionSuggestionKind.IMPORT);
105 assertSuggest('dart:core', 114 assertSuggest('dart:core',
106 csKind: CompletionSuggestionKind.IMPORT, relevance: DART_RELEVANCE_LOW); 115 csKind: CompletionSuggestionKind.IMPORT, relevance: DART_RELEVANCE_LOW);
107 assertNotSuggested('dart:_internal'); 116 assertNotSuggested('dart:_internal');
108 assertSuggest('dart:async', csKind: CompletionSuggestionKind.IMPORT); 117 assertSuggest('dart:async', csKind: CompletionSuggestionKind.IMPORT);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 322
314 test_import_raw() async { 323 test_import_raw() async {
315 addTestSource('import r"^" import'); 324 addTestSource('import r"^" import');
316 await computeSuggestions(); 325 await computeSuggestions();
317 expect(replacementOffset, completionOffset); 326 expect(replacementOffset, completionOffset);
318 expect(replacementLength, 0); 327 expect(replacementLength, 0);
319 assertSuggest('dart:', csKind: CompletionSuggestionKind.IMPORT); 328 assertSuggest('dart:', csKind: CompletionSuggestionKind.IMPORT);
320 assertSuggest('package:', csKind: CompletionSuggestionKind.IMPORT); 329 assertSuggest('package:', csKind: CompletionSuggestionKind.IMPORT);
321 } 330 }
322 331
332 test_import_without_any_quotes() async {
333 addTestSource('import ^ import');
334 await computeSuggestions();
335 expect(replacementOffset, completionOffset);
336 expect(replacementLength, 0);
337 assertNoSuggestions();
338 }
339
340 test_import_without_any_quotes_eof() async {
341 addTestSource('import ^');
342 await computeSuggestions();
343 expect(replacementOffset, completionOffset);
344 expect(replacementLength, 0);
345 assertNoSuggestions();
346 }
347
348 test_import_without_closing_quote_eof() async {
349 addTestSource('import "^');
350 await computeSuggestions();
351 expect(replacementOffset, completionOffset);
352 expect(replacementLength, 0);
353 assertSuggest('dart:', csKind: CompletionSuggestionKind.IMPORT);
354 assertSuggest('package:', csKind: CompletionSuggestionKind.IMPORT);
355 }
356
357 test_import_without_closing_quote_eof2() async {
358 addTestSource('import "^d');
359 await computeSuggestions();
360 expect(replacementOffset, completionOffset);
361 expect(replacementLength, 1);
362 assertSuggest('dart:', csKind: CompletionSuggestionKind.IMPORT);
363 assertSuggest('package:', csKind: CompletionSuggestionKind.IMPORT);
364 }
365
366 test_import_without_closing_quote_eof3() async {
367 addTestSource('import "d^');
368 await computeSuggestions();
369 expect(replacementOffset, completionOffset - 1);
370 expect(replacementLength, 1);
371 assertSuggest('dart:', csKind: CompletionSuggestionKind.IMPORT);
372 assertSuggest('package:', csKind: CompletionSuggestionKind.IMPORT);
373 }
374
375 test_import_without_closing_quote_eof4() async {
376 addTestSource('import "d^"');
377 await computeSuggestions();
378 expect(replacementOffset, completionOffset - 1);
379 expect(replacementLength, 1);
380 assertSuggest('dart:', csKind: CompletionSuggestionKind.IMPORT);
381 assertSuggest('package:', csKind: CompletionSuggestionKind.IMPORT);
382 }
383
323 test_outside_import() async { 384 test_outside_import() async {
324 addTestSource('import ^"d" import'); 385 addTestSource('import ^"d" import');
325 await computeSuggestions(); 386 await computeSuggestions();
326 assertNoSuggestions(); 387 assertNoSuggestions();
327 } 388 }
328 389
329 test_outside_import2() async { 390 test_outside_import2() async {
330 addTestSource('import "d"^ import'); 391 addTestSource('import "d"^ import');
331 await computeSuggestions(); 392 await computeSuggestions();
332 assertNoSuggestions(); 393 assertNoSuggestions();
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 assertNotSuggested('foo/'); 625 assertNotSuggested('foo/');
565 assertNotSuggested('foo/bar.dart'); 626 assertNotSuggested('foo/bar.dart');
566 assertSuggest('../blat.dart', csKind: CompletionSuggestionKind.IMPORT); 627 assertSuggest('../blat.dart', csKind: CompletionSuggestionKind.IMPORT);
567 } 628 }
568 } 629 }
569 630
570 class _TestWinResourceProvider extends MemoryResourceProvider { 631 class _TestWinResourceProvider extends MemoryResourceProvider {
571 @override 632 @override
572 Context get pathContext => windows; 633 Context get pathContext => windows;
573 } 634 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/completion_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698