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(); |