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

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

Issue 1255953004: better completions in switch statements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 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
« no previous file with comments | « pkg/analysis_server/test/services/completion/completion_test_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/optype_test.dart
diff --git a/pkg/analysis_server/test/services/completion/optype_test.dart b/pkg/analysis_server/test/services/completion/optype_test.dart
index 27e32b747fd0b7bf4e35fa73857799d1298674be..04ce497bc8ccbf4d22e71df7126e07f324a7cfa6 100644
--- a/pkg/analysis_server/test/services/completion/optype_test.dart
+++ b/pkg/analysis_server/test/services/completion/optype_test.dart
@@ -1124,19 +1124,72 @@ class C2 {
assertOpType(typeNames: true);
}
- test_SwitchCase() {
+ test_SwitchCase_before() {
+ // SwitchCase SwitchStatement Block
+ addTestSource('main() {switch(k) {^case 1:}}');
+ assertOpType();
+ }
+
+ test_SwitchCase_between() {
+ // SwitchCase SwitchStatement Block
+ addTestSource('main() {switch(k) {case 1: ^ case 2: return}}');
+ assertOpType(returnValue: true, typeNames: true, voidReturn: true);
+ }
+
+ test_SwitchCase_expression1() {
// SimpleIdentifier SwitchCase SwitchStatement
addTestSource('''m() {switch (x) {case ^D: return;}}''');
- // TODO (danrubel) should refine this to return constants
+ assertOpType(returnValue: true, typeNames: true);
+ }
+
+ test_SwitchCase_expression2() {
+ // SimpleIdentifier SwitchCase SwitchStatement
+ addTestSource('''m() {switch (x) {case ^}}''');
+ assertOpType(returnValue: true, typeNames: true);
+ }
+
+ test_SwitchDefault_before() {
+ // SwitchDefault SwitchStatement Block
+ addTestSource('main() {switch(k) { ^ default: return;}}');
+ assertOpType();
+ }
+
+ test_SwitchDefault_between() {
+ // SwitchDefault SwitchStatement Block
+ addTestSource('main() {switch(k) {case 1: ^ default: return;}}');
+ assertOpType(returnValue: true, typeNames: true, voidReturn: true);
+ }
+
+ test_SwitchStatement_body_empty() {
+ // Token('}') SwitchStatement Block
+ addTestSource('main() {switch(k) {^}}');
+ assertOpType();
+ }
+
+ test_SwitchStatement_body_end() {
+ // Token('}') SwitchStatement Block
+ addTestSource('main() {switch(k) {case 1:^}}');
assertOpType(returnValue: true, typeNames: true, voidReturn: true);
}
- test_SwitchStatement() {
+ test_SwitchStatement_expression1() {
// SimpleIdentifier SwitchStatement Block
addTestSource('main() {switch(^k) {case 1:{}}}');
assertOpType(returnValue: true, typeNames: true);
}
+ test_SwitchStatement_expression2() {
+ // SimpleIdentifier SwitchStatement Block
+ addTestSource('main() {switch(k^) {case 1:{}}}');
+ assertOpType(returnValue: true, typeNames: true);
+ }
+
+ test_SwitchStatement_expression_empty() {
+ // SimpleIdentifier SwitchStatement Block
+ addTestSource('main() {switch(^) {case 1:{}}}');
+ assertOpType(returnValue: true, typeNames: true);
+ }
+
test_ThisExpression_block() {
// MethodInvocation ExpressionStatement Block
addTestSource('''
« no previous file with comments | « pkg/analysis_server/test/services/completion/completion_test_util.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698