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

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

Issue 2848643003: Fix `selectionOffset` testing. (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
index c47e2241b9932d62c11b449e1a155cd232aaee00..7f13967820621442fc96b20f063b4768f98cedb1 100644
--- a/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
@@ -104,6 +104,8 @@ class ArgListContributorTest extends DartCompletionContributorTest {
List<CompletionSuggestion> expected = new List<CompletionSuggestion>();
namedArgumentsWithTypes.forEach((String name, String type) {
String completion = includeColon ? '$name: ' : name;
+ // Selection should be before any trailing commas.
+ int selectionOffset = completion.length;
if (includeComma) {
completion = '$completion,';
}
@@ -111,7 +113,8 @@ class ArgListContributorTest extends DartCompletionContributorTest {
csKind: CompletionSuggestionKind.NAMED_ARGUMENT,
relevance: DART_RELEVANCE_NAMED_PARAMETER,
paramName: name,
- paramType: type));
+ paramType: type,
+ selectionOffset: selectionOffset));
});
assertNoOtherSuggestions(expected);
}
@@ -122,9 +125,13 @@ class ArgListContributorTest extends DartCompletionContributorTest {
void assertSuggestions(List<String> suggestions) {
List<CompletionSuggestion> expected = new List<CompletionSuggestion>();
for (String suggestion in suggestions) {
+ // Selection offset should be before any trailing commas.
+ int selectionOffset =
+ suggestion.endsWith(',') ? suggestion.length - 1 : suggestion.length;
expected.add(assertSuggest('$suggestion',
csKind: CompletionSuggestionKind.NAMED_ARGUMENT,
- relevance: DART_RELEVANCE_NAMED_PARAMETER));
+ relevance: DART_RELEVANCE_NAMED_PARAMETER,
+ selectionOffset: selectionOffset));
}
assertNoOtherSuggestions(expected);
}
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698