Add failing tests for suggesting else in an if element
Change-Id: I8e04fc190a598c812da68b328e5e5628afa01cb4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181880
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
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 f5f9774..5bda1ad 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
@@ -1470,6 +1470,77 @@
assertSuggestKeywords(statementStartOutsideClass);
}
+ @failingTest
+ Future<void> test_ifElement_noElse_last() async {
+ addTestSource('''
+void f() {
+ [if (true) 1 ^];
+}
+''');
+ await computeSuggestions();
+ assertSuggestKeywords([
+ ...COLLECTION_ELEMENT_START,
+ ...EXPRESSION_START_NO_INSTANCE,
+ Keyword.ELSE
+ ]);
+ }
+
+ Future<void> test_ifElement_noElse_notInElement() async {
+ addTestSource('''
+void f() {
+ [if (true) 1, ^];
+}
+''');
+ await computeSuggestions();
+ assertSuggestKeywords(
+ [...COLLECTION_ELEMENT_START, ...EXPRESSION_START_NO_INSTANCE]);
+ }
+
+ @failingTest
+ Future<void> test_ifElement_noElse_notLast() async {
+ addTestSource('''
+void f(int i) {
+ [if (true) 1 ^, i];
+}
+''');
+ await computeSuggestions();
+ assertSuggestKeywords([
+ ...COLLECTION_ELEMENT_START,
+ ...EXPRESSION_START_NO_INSTANCE,
+ Keyword.ELSE
+ ]);
+ }
+
+ @failingTest
+ Future<void> test_ifElement_partialElse_last() async {
+ addTestSource('''
+void f() {
+ [if (true) 1 e^];
+}
+''');
+ await computeSuggestions();
+ assertSuggestKeywords([
+ ...COLLECTION_ELEMENT_START,
+ ...EXPRESSION_START_NO_INSTANCE,
+ Keyword.ELSE
+ ]);
+ }
+
+ @failingTest
+ Future<void> test_ifElement_partialElse_notLast() async {
+ addTestSource('''
+void f(int i) {
+ [if (true) 1 e^, i];
+}
+''');
+ await computeSuggestions();
+ assertSuggestKeywords([
+ ...COLLECTION_ELEMENT_START,
+ ...EXPRESSION_START_NO_INSTANCE,
+ Keyword.ELSE
+ ]);
+ }
+
Future<void> test_ifOrForElement_forElement() async {
addTestSource('''
f() => [for (var e in c) ^];