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

Side by Side Diff: pkg/analysis_server/test/services/correction/assist_test.dart

Issue 1466623002: Convert into block documentation comment assist. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/assist_internal.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.correction.assist; 5 library test.services.correction.assist;
6 6
7 import 'package:analysis_server/plugin/edit/assist/assist_core.dart'; 7 import 'package:analysis_server/plugin/edit/assist/assist_core.dart';
8 import 'package:analysis_server/plugin/protocol/protocol.dart'; 8 import 'package:analysis_server/plugin/protocol/protocol.dart';
9 import 'package:analysis_server/src/plugin/server_plugin.dart'; 9 import 'package:analysis_server/src/plugin/server_plugin.dart';
10 import 'package:analysis_server/src/services/correction/assist.dart'; 10 import 'package:analysis_server/src/services/correction/assist.dart';
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 void test_assignToLocalVariable_void() { 836 void test_assignToLocalVariable_void() {
837 resolveTestUnit(''' 837 resolveTestUnit('''
838 main() { 838 main() {
839 f(); 839 f();
840 } 840 }
841 void f() {} 841 void f() {}
842 '''); 842 ''');
843 assertNoAssistAt('f();', DartAssistKind.ASSIGN_TO_LOCAL_VARIABLE); 843 assertNoAssistAt('f();', DartAssistKind.ASSIGN_TO_LOCAL_VARIABLE);
844 } 844 }
845 845
846 void test_convertIntoBlockDocumentationComment_BAD_alreadyBlock() {
847 resolveTestUnit('''
848 /**
849 * AAAAAAA
850 */
851 class A {}
852 ''');
853 assertNoAssistAt('AAA', DartAssistKind.CONVERT_DOCUMENTATION_INTO_BLOCK);
854 }
855
856 void test_convertIntoBlockDocumentationComment_BAD_notDocumentation() {
857 resolveTestUnit('''
858 // AAAA
859 class A {}
860 ''');
861 assertNoAssistAt('AAA', DartAssistKind.CONVERT_DOCUMENTATION_INTO_BLOCK);
862 }
863
864 void test_convertIntoBlockDocumentationComment_OK_onReference() {
865 resolveTestUnit('''
866 /// AAAAAAA [int] AAAAAAA
867 class A {}
868 ''');
869 assertHasAssistAt(
870 'nt]',
871 DartAssistKind.CONVERT_DOCUMENTATION_INTO_BLOCK,
872 '''
873 /**
874 * AAAAAAA [int] AAAAAAA
875 */
876 class A {}
877 ''');
878 }
879
880 void test_convertIntoBlockDocumentationComment_OK_onText() {
881 resolveTestUnit('''
882 class A {
883 /// AAAAAAA [int] AAAAAAA
884 /// BBBBBBBB BBBB BBBB
885 /// CCC [A] CCCCCCCCCCC
886 mmm() {}
887 }
888 ''');
889 assertHasAssistAt(
890 'AAA [',
891 DartAssistKind.CONVERT_DOCUMENTATION_INTO_BLOCK,
892 '''
893 class A {
894 /**
895 * AAAAAAA [int] AAAAAAA
896 * BBBBBBBB BBBB BBBB
897 * CCC [A] CCCCCCCCCCC
898 */
899 mmm() {}
900 }
901 ''');
902 }
903
846 void test_convertToBlockBody_OK_async() { 904 void test_convertToBlockBody_OK_async() {
847 resolveTestUnit(''' 905 resolveTestUnit('''
848 class A { 906 class A {
849 mmm() async => 123; 907 mmm() async => 123;
850 } 908 }
851 '''); 909 ''');
852 assertHasAssistAt( 910 assertHasAssistAt(
853 'mmm()', 911 'mmm()',
854 DartAssistKind.CONVERT_INTO_BLOCK_BODY, 912 DartAssistKind.CONVERT_INTO_BLOCK_BODY,
855 ''' 913 '''
(...skipping 2396 matching lines...) Expand 10 before | Expand all | Expand 10 after
3252 3310
3253 void test_replaceIfElseWithConditional_wrong_notIfStatement() { 3311 void test_replaceIfElseWithConditional_wrong_notIfStatement() {
3254 resolveTestUnit(''' 3312 resolveTestUnit('''
3255 main() { 3313 main() {
3256 print(0); 3314 print(0);
3257 } 3315 }
3258 '''); 3316 ''');
3259 assertNoAssistAt('print', DartAssistKind.REPLACE_IF_ELSE_WITH_CONDITIONAL); 3317 assertNoAssistAt('print', DartAssistKind.REPLACE_IF_ELSE_WITH_CONDITIONAL);
3260 } 3318 }
3261 3319
3262 void test_replaceIfElseWithConditional_wrong_notSingleStatememt() { 3320 void test_replaceIfElseWithConditional_wrong_notSingleStatement() {
3263 resolveTestUnit(''' 3321 resolveTestUnit('''
3264 main() { 3322 main() {
3265 int vvv; 3323 int vvv;
3266 if (true) { 3324 if (true) {
3267 print(0); 3325 print(0);
3268 vvv = 111; 3326 vvv = 111;
3269 } else { 3327 } else {
3270 print(0); 3328 print(0);
3271 vvv = 222; 3329 vvv = 222;
3272 } 3330 }
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
3697 positions.add(new Position(testFile, offset)); 3755 positions.add(new Position(testFile, offset));
3698 } 3756 }
3699 return positions; 3757 return positions;
3700 } 3758 }
3701 3759
3702 void _setStartEndSelection() { 3760 void _setStartEndSelection() {
3703 offset = findOffset('// start\n') + '// start\n'.length; 3761 offset = findOffset('// start\n') + '// start\n'.length;
3704 length = findOffset('// end') - offset; 3762 length = findOffset('// end') - offset;
3705 } 3763 }
3706 } 3764 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/assist_internal.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698