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

Side by Side Diff: pkg/analysis_server/test/services/completion/statement/statement_completion_test.dart

Issue 2837063003: Add colon to switch cases and default (Closed)
Patch Set: reformat 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.services.completion.statement; 5 library test.services.completion.statement;
6 6
7 import 'package:analysis_server/src/protocol_server.dart'; 7 import 'package:analysis_server/src/protocol_server.dart';
8 import 'package:analysis_server/src/services/completion/statement/statement_comp letion.dart'; 8 import 'package:analysis_server/src/services/completion/statement/statement_comp letion.dart';
9 import 'package:analyzer/src/dart/analysis/driver.dart'; 9 import 'package:analyzer/src/dart/analysis/driver.dart';
10 import 'package:test/test.dart'; 10 import 'package:test/test.dart';
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 int v = 1; 758 int v = 1;
759 //// 759 ////
760 } 760 }
761 ''', 761 ''',
762 (s) => _afterLast(s, ' ')); 762 (s) => _afterLast(s, ' '));
763 } 763 }
764 } 764 }
765 765
766 @reflectiveTest 766 @reflectiveTest
767 class _SwitchCompletionTest extends StatementCompletionTest { 767 class _SwitchCompletionTest extends StatementCompletionTest {
768 test_caseNoColon() async {
769 await _prepareCompletion(
770 'label',
771 '''
772 main(x) {
773 switch (x) {
774 case label
775 }
776 }
777 ''',
778 atEnd: true);
779 _assertHasChange(
780 'Complete switch-statement',
781 '''
782 main(x) {
783 switch (x) {
784 case label: ////
785 }
786 }
787 ''',
788 (s) => _after(s, 'label: '));
789 }
790
791 test_defaultNoColon() async {
792 await _prepareCompletion(
793 'default',
794 '''
795 main(x) {
796 switch (x) {
797 default
798 }
799 }
800 ''',
801 atEnd: true);
802 _assertHasChange(
803 'Complete switch-statement',
804 '''
805 main(x) {
806 switch (x) {
807 default: ////
808 }
809 }
810 ''',
811 (s) => _after(s, 'default: '));
812 }
813
768 test_emptyCondition() async { 814 test_emptyCondition() async {
769 await _prepareCompletion( 815 await _prepareCompletion(
770 'switch', 816 'switch',
771 ''' 817 '''
772 main() { 818 main() {
773 switch () 819 switch ()
774 } 820 }
775 ''', 821 ''',
776 atEnd: true); 822 atEnd: true);
777 _assertHasChange( 823 _assertHasChange(
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 ''' 1132 '''
1087 main() { 1133 main() {
1088 while () { 1134 while () {
1089 //// 1135 ////
1090 } 1136 }
1091 } 1137 }
1092 ''', 1138 ''',
1093 (s) => _after(s, 'while (')); 1139 (s) => _after(s, 'while ('));
1094 } 1140 }
1095 } 1141 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698