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

Unified Diff: pkg/analysis_services/test/completion/completion_test_util.dart

Issue 459853003: remove duplicate suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix suggestion notification processing in test Created 6 years, 4 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
Index: pkg/analysis_services/test/completion/completion_test_util.dart
diff --git a/pkg/analysis_services/test/completion/completion_test_util.dart b/pkg/analysis_services/test/completion/completion_test_util.dart
index 18b58ecc97517ef2739b597af103a2db3b3919d4..6e501f1284938ee620a4d214fb445b545540a03d 100644
--- a/pkg/analysis_services/test/completion/completion_test_util.dart
+++ b/pkg/analysis_services/test/completion/completion_test_util.dart
@@ -55,11 +55,20 @@ class AbstractCompletionTest extends AbstractContextTest {
void assertSuggest(CompletionSuggestionKind kind, String completion,
[CompletionRelevance relevance = CompletionRelevance.DEFAULT, bool isDeprecated
= false, bool isPotential = false]) {
- var cs =
- suggestions.firstWhere((cs) => cs.completion == completion, orElse: () {
+ var cs;
+ suggestions.forEach((s) {
+ if (s.completion == completion) {
+ if (cs == null) {
+ cs = s;
+ } else {
+ fail('expected exactly one $completion but found > 1');
+ }
+ }
+ });
+ if (cs == null) {
var completions = suggestions.map((s) => s.completion).toList();
fail('expected "$completion" but found\n $completions');
- });
+ }
expect(cs.kind, equals(kind));
expect(cs.relevance, equals(relevance));
expect(cs.selectionOffset, equals(completion.length));

Powered by Google App Engine
This is Rietveld 408576698