Index: pkg/analysis_server/test/services/completion/keyword_contributor_test.dart |
diff --git a/pkg/analysis_server/test/services/completion/keyword_contributor_test.dart b/pkg/analysis_server/test/services/completion/keyword_contributor_test.dart |
index 900062c9c1e2b7c92baa279c992c9657b26fd4a2..98011fd2763f0307b3d04a0e0143e60d3c63d0a0 100644 |
--- a/pkg/analysis_server/test/services/completion/keyword_contributor_test.dart |
+++ b/pkg/analysis_server/test/services/completion/keyword_contributor_test.dart |
@@ -841,6 +841,14 @@ class A { |
relevance: DART_RELEVANCE_HIGH); |
} |
+ test_import_deferred_as5() { |
+ addTestSource('import "foo" sh^ import "bar"; import "baz";'); |
+ expect(computeFast(), isTrue); |
+ assertSuggestKeywords([Keyword.AS], |
+ pseudoKeywords: ['deferred as', 'show', 'hide'], |
+ relevance: DART_RELEVANCE_HIGH); |
+ } |
+ |
test_import_deferred_not() { |
addTestSource('import "foo" as foo ^;'); |
expect(computeFast(), isTrue); |
@@ -848,6 +856,14 @@ class A { |
pseudoKeywords: ['show', 'hide'], relevance: DART_RELEVANCE_HIGH); |
} |
+ test_import_deferred_partial() { |
+ addTestSource('import "package:foo/foo.dart" def^ as foo;'); |
+ expect(computeFast(), isTrue); |
+ assertSuggestKeywords([Keyword.DEFERRED], relevance: DART_RELEVANCE_HIGH); |
+ expect(request.replacementOffset, 30); |
+ expect(request.replacementLength, 3); |
+ } |
+ |
test_import_incomplete() { |
addTestSource('import "^"'); |
expect(computeFast(), isTrue); |
@@ -855,6 +871,67 @@ class A { |
assertSuggestKeywords([]); |
Brian Wilkerson
2015/08/12 13:59:25
I would have expected that 'assertNoSuggestions()'
danrubel
2015/08/15 19:17:16
Yup. That 2nd line is unnecessary. Removed.
|
} |
+ test_import_partial() { |
+ addTestSource('imp^ import "package:foo/foo.dart"; import "bar.dart";'); |
+ expect(computeFast(), isTrue); |
+ // TODO(danrubel) should not suggest declaration keywords |
Brian Wilkerson
2015/08/12 13:59:25
I'd rather see a test that is correct that is mark
danrubel
2015/08/15 19:17:17
Fair enough. Added.
|
+ assertSuggestKeywords(DIRECTIVE_DECLARATION_AND_LIBRARY_KEYWORDS, |
+ relevance: DART_RELEVANCE_HIGH); |
+ expect(request.replacementOffset, 0); |
+ expect(request.replacementLength, 3); |
+ } |
+ |
+ test_import_partial2() { |
+ addTestSource('^imp import "package:foo/foo.dart";'); |
+ expect(computeFast(), isTrue); |
+ // TODO(danrubel) should not suggest declaration keywords |
+ assertSuggestKeywords(DIRECTIVE_DECLARATION_AND_LIBRARY_KEYWORDS, |
+ relevance: DART_RELEVANCE_HIGH); |
+ expect(request.replacementOffset, 0); |
+ expect(request.replacementLength, 3); |
+ } |
+ |
+ test_import_partial3() { |
+ addTestSource(' ^imp import "package:foo/foo.dart"; import "bar.dart";'); |
+ expect(computeFast(), isTrue); |
+ // TODO(danrubel) should not suggest declaration keywords |
+ assertSuggestKeywords(DIRECTIVE_DECLARATION_AND_LIBRARY_KEYWORDS, |
+ relevance: DART_RELEVANCE_HIGH); |
+ expect(request.replacementOffset, 1); |
+ expect(request.replacementLength, 3); |
+ } |
+ |
+ test_import_partial4() { |
+ addTestSource('^ imp import "package:foo/foo.dart";'); |
+ expect(computeFast(), isTrue); |
+ // TODO(danrubel) should not suggest declaration keywords |
+ assertSuggestKeywords(DIRECTIVE_DECLARATION_AND_LIBRARY_KEYWORDS, |
+ relevance: DART_RELEVANCE_HIGH); |
+ expect(request.replacementOffset, 0); |
+ expect(request.replacementLength, 0); |
+ } |
+ |
+ test_import_partial5() { |
+ addTestSource('library libA; imp^ import "package:foo/foo.dart";'); |
+ expect(computeFast(), isTrue); |
+ // TODO(danrubel) should not suggest declaration keywords |
+ assertSuggestKeywords(DIRECTIVE_AND_DECLARATION_KEYWORDS, |
+ relevance: DART_RELEVANCE_HIGH); |
+ expect(request.replacementOffset, 14); |
+ expect(request.replacementLength, 3); |
+ } |
+ |
+ test_import_partial6() { |
+ addTestSource( |
+ 'library bar; import "zoo.dart"; imp^ import "package:foo/foo.dart";'); |
+ expect(computeFast(), isTrue); |
+ // TODO(danrubel) should not suggest declaration keywords |
+ assertSuggestKeywords(DIRECTIVE_AND_DECLARATION_KEYWORDS, |
+ relevance: DART_RELEVANCE_HIGH); |
+ expect(request.replacementOffset, 32); |
+ expect(request.replacementLength, 3); |
+ } |
+ |
test_library() { |
addTestSource('library foo;^'); |
expect(computeFast(), isTrue); |