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

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

Issue 1511553005: suggest yield and yeild* - fixes #24346 (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge and cleanup imports 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/lib/src/services/completion/dart/keyword_contributor.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 c4d9b8b1ebcd302f0d29cde8b20d3d352021e27a..1d3549d21ae4a642082b4d97846b695e30f4d420 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
@@ -727,6 +727,19 @@ class A {
assertSuggestKeywords(STMT_START_OUTSIDE_CLASS, pseudoKeywords: ['await']);
}
+ test_function_body_inClass_constructorInitializer_async_star() async {
+ addTestSource(r'''
+ foo(p) {}
+ class A {
+ final f;
+ A() : f = foo(() async* {^});
+ }
+ ''');
+ await computeSuggestions();
+ assertSuggestKeywords(STMT_START_OUTSIDE_CLASS,
+ pseudoKeywords: ['await', 'yield', 'yield*']);
+ }
+
test_function_body_inClass_field() async {
addTestSource(r'''
class A {
@@ -777,6 +790,21 @@ class A {
assertSuggestKeywords(STMT_START_IN_CLASS, pseudoKeywords: ['await']);
}
+ test_function_body_inClass_methodBody_inFunction_async_star() async {
+ addTestSource(r'''
+ class A {
+ m() {
+ f() {
+ f2() async* {^};
+ };
+ }
+ }
+ ''');
+ await computeSuggestions();
+ assertSuggestKeywords(STMT_START_IN_CLASS,
+ pseudoKeywords: ['await', 'yield', 'yield*']);
+ }
+
test_function_body_inUnit() async {
addTestSource('main() {^}');
await computeSuggestions();
@@ -795,6 +823,34 @@ class A {
assertSuggestKeywords(STMT_START_OUTSIDE_CLASS, pseudoKeywords: ['await']);
}
+ test_function_body_inUnit_async_star() async {
+ addTestSource('main() async* {n^}');
+ await computeSuggestions();
+ assertSuggestKeywords(STMT_START_OUTSIDE_CLASS,
+ pseudoKeywords: ['await', 'yield', 'yield*']);
+ }
+
+ test_function_body_inUnit_async_star2() async {
+ addTestSource('main() async* {n^ foo}');
+ await computeSuggestions();
+ assertSuggestKeywords(STMT_START_OUTSIDE_CLASS,
+ pseudoKeywords: ['await', 'yield', 'yield*']);
+ }
+
+ test_function_body_inUnit_sync_star() async {
+ addTestSource('main() sync* {n^}');
+ await computeSuggestions();
+ assertSuggestKeywords(STMT_START_OUTSIDE_CLASS,
+ pseudoKeywords: ['await', 'yield', 'yield*']);
+ }
+
+ test_function_body_inUnit_sync_star2() async {
+ addTestSource('main() sync* {n^ foo}');
+ await computeSuggestions();
+ assertSuggestKeywords(STMT_START_OUTSIDE_CLASS,
+ pseudoKeywords: ['await', 'yield', 'yield*']);
+ }
+
test_if_expression_in_class() async {
addTestSource('class A {foo() {if (^) }}');
await computeSuggestions();
@@ -1203,6 +1259,13 @@ main() {
assertSuggestKeywords(STMT_START_IN_CLASS, pseudoKeywords: ['await']);
}
+ test_method_body_async_star() async {
+ addTestSource('class A { foo() async* {^}}');
+ await computeSuggestions();
+ assertSuggestKeywords(STMT_START_IN_CLASS,
+ pseudoKeywords: ['await', 'yield', 'yield*']);
+ }
+
test_method_body_async2() async {
addTestSource('class A { foo() async => ^}');
await computeSuggestions();
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698