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

Unified Diff: pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart

Issue 1499003002: extract ReplacementRange for use in tests (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 years 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/services/completion/dart/completion_contributor_util.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/keyword_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart
index 4a3b8cce9da690262f4e9dd53ce4386e8d1c784e..8933b0a1aa0c8f120469119a6feb7c9add9bdf7c 100644
--- a/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart
@@ -963,6 +963,8 @@ class A {
test_import_deferred_partial() async {
addTestSource('import "package:foo/foo.dart" def^ as foo;');
await computeSuggestions();
+ expect(replacementOffset, 30);
+ expect(replacementLength, 3);
assertSuggestKeywords([Keyword.DEFERRED], relevance: DART_RELEVANCE_HIGH);
expect(suggestions[0].selectionOffset, 8);
expect(suggestions[0].selectionLength, 0);
@@ -977,6 +979,8 @@ class A {
test_import_partial() async {
addTestSource('imp^ import "package:foo/foo.dart"; import "bar.dart";');
await computeSuggestions();
+ expect(replacementOffset, 0);
+ expect(replacementLength, 3);
// TODO(danrubel) should not suggest declaration keywords
assertSuggestKeywords(DIRECTIVE_DECLARATION_AND_LIBRARY_KEYWORDS,
relevance: DART_RELEVANCE_HIGH);
@@ -985,6 +989,8 @@ class A {
test_import_partial2() async {
addTestSource('^imp import "package:foo/foo.dart";');
await computeSuggestions();
+ expect(replacementOffset, 0);
+ expect(replacementLength, 3);
// TODO(danrubel) should not suggest declaration keywords
assertSuggestKeywords(DIRECTIVE_DECLARATION_AND_LIBRARY_KEYWORDS,
relevance: DART_RELEVANCE_HIGH);
@@ -993,6 +999,8 @@ class A {
test_import_partial3() async {
addTestSource(' ^imp import "package:foo/foo.dart"; import "bar.dart";');
await computeSuggestions();
+ expect(replacementOffset, 1);
+ expect(replacementLength, 3);
// TODO(danrubel) should not suggest declaration keywords
assertSuggestKeywords(DIRECTIVE_DECLARATION_AND_LIBRARY_KEYWORDS,
relevance: DART_RELEVANCE_HIGH);
@@ -1001,6 +1009,8 @@ class A {
test_import_partial4() async {
addTestSource('^ imp import "package:foo/foo.dart";');
await computeSuggestions();
+ expect(replacementOffset, 0);
+ expect(replacementLength, 0);
// TODO(danrubel) should not suggest declaration keywords
assertSuggestKeywords(DIRECTIVE_DECLARATION_AND_LIBRARY_KEYWORDS,
relevance: DART_RELEVANCE_HIGH);
@@ -1009,6 +1019,8 @@ class A {
test_import_partial5() async {
addTestSource('library libA; imp^ import "package:foo/foo.dart";');
await computeSuggestions();
+ expect(replacementOffset, 14);
+ expect(replacementLength, 3);
// TODO(danrubel) should not suggest declaration keywords
assertSuggestKeywords(DIRECTIVE_AND_DECLARATION_KEYWORDS,
relevance: DART_RELEVANCE_HIGH);
@@ -1018,6 +1030,8 @@ class A {
addTestSource(
'library bar; import "zoo.dart"; imp^ import "package:foo/foo.dart";');
await computeSuggestions();
+ expect(replacementOffset, 32);
+ expect(replacementLength, 3);
// TODO(danrubel) should not suggest declaration keywords
assertSuggestKeywords(DIRECTIVE_AND_DECLARATION_KEYWORDS,
relevance: DART_RELEVANCE_HIGH);
@@ -1345,6 +1359,8 @@ main() {
test_switch_start5() async {
addTestSource('main() {switch(1) {c^ default:}}');
await computeSuggestions();
+ expect(replacementOffset, 19);
+ expect(replacementLength, 1);
assertSuggestKeywords([Keyword.CASE, Keyword.DEFAULT],
relevance: DART_RELEVANCE_HIGH);
}
@@ -1352,6 +1368,8 @@ main() {
test_switch_start6() async {
addTestSource('main() {switch(1) {c^}}');
await computeSuggestions();
+ expect(replacementOffset, 19);
+ expect(replacementLength, 1);
assertSuggestKeywords([Keyword.CASE, Keyword.DEFAULT],
relevance: DART_RELEVANCE_HIGH);
}
@@ -1359,6 +1377,8 @@ main() {
test_switch_start7() async {
addTestSource('main() {switch(1) { c^ }}');
await computeSuggestions();
+ expect(replacementOffset, 20);
+ expect(replacementLength, 1);
assertSuggestKeywords([Keyword.CASE, Keyword.DEFAULT],
relevance: DART_RELEVANCE_HIGH);
}
« no previous file with comments | « pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698