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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/test/completion_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/completion/dart/uri_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/completion/dart/uri_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/uri_contributor_test.dart
index 8bd4e6ba4b61e9121e744223c883ccc56ae532f5..99cfd293109fadb250e4954a850b9347635043e3 100644
--- a/pkg/analysis_server/test/services/completion/dart/uri_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/uri_contributor_test.dart
@@ -96,6 +96,15 @@ class UriContributorTest extends DartCompletionContributorTest {
assertSuggest('package:', csKind: CompletionSuggestionKind.IMPORT);
}
+ test_import3() async {
+ addTestSource('import "^ import');
+ await computeSuggestions();
+ expect(replacementOffset, completionOffset);
+ expect(replacementLength, 7);
+ assertSuggest('dart:', csKind: CompletionSuggestionKind.IMPORT);
+ assertSuggest('package:', csKind: CompletionSuggestionKind.IMPORT);
+ }
+
test_import_dart() async {
addTestSource('import "d^" import');
await computeSuggestions();
@@ -320,6 +329,58 @@ class UriContributorTest extends DartCompletionContributorTest {
assertSuggest('package:', csKind: CompletionSuggestionKind.IMPORT);
}
+ test_import_without_any_quotes() async {
+ addTestSource('import ^ import');
+ await computeSuggestions();
+ expect(replacementOffset, completionOffset);
+ expect(replacementLength, 0);
+ assertNoSuggestions();
+ }
+
+ test_import_without_any_quotes_eof() async {
+ addTestSource('import ^');
+ await computeSuggestions();
+ expect(replacementOffset, completionOffset);
+ expect(replacementLength, 0);
+ assertNoSuggestions();
+ }
+
+ test_import_without_closing_quote_eof() async {
+ addTestSource('import "^');
+ await computeSuggestions();
+ expect(replacementOffset, completionOffset);
+ expect(replacementLength, 0);
+ assertSuggest('dart:', csKind: CompletionSuggestionKind.IMPORT);
+ assertSuggest('package:', csKind: CompletionSuggestionKind.IMPORT);
+ }
+
+ test_import_without_closing_quote_eof2() async {
+ addTestSource('import "^d');
+ await computeSuggestions();
+ expect(replacementOffset, completionOffset);
+ expect(replacementLength, 1);
+ assertSuggest('dart:', csKind: CompletionSuggestionKind.IMPORT);
+ assertSuggest('package:', csKind: CompletionSuggestionKind.IMPORT);
+ }
+
+ test_import_without_closing_quote_eof3() async {
+ addTestSource('import "d^');
+ await computeSuggestions();
+ expect(replacementOffset, completionOffset - 1);
+ expect(replacementLength, 1);
+ assertSuggest('dart:', csKind: CompletionSuggestionKind.IMPORT);
+ assertSuggest('package:', csKind: CompletionSuggestionKind.IMPORT);
+ }
+
+ test_import_without_closing_quote_eof4() async {
+ addTestSource('import "d^"');
+ await computeSuggestions();
+ expect(replacementOffset, completionOffset - 1);
+ expect(replacementLength, 1);
+ assertSuggest('dart:', csKind: CompletionSuggestionKind.IMPORT);
+ assertSuggest('package:', csKind: CompletionSuggestionKind.IMPORT);
+ }
+
test_outside_import() async {
addTestSource('import ^"d" import');
await computeSuggestions();
« 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