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

Side by Side Diff: pkg/analysis_server/test/edit/refactoring_test.dart

Issue 2975253002: Format analyzer, analysis_server, analyzer_plugin, front_end and kernel with the latest dartfmt. (Closed)
Patch Set: Created 3 years, 5 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) 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:analysis_server/protocol/protocol.dart'; 7 import 'package:analysis_server/protocol/protocol.dart';
8 import 'package:analysis_server/protocol/protocol_generated.dart'; 8 import 'package:analysis_server/protocol/protocol_generated.dart';
9 import 'package:analysis_server/src/edit/edit_domain.dart'; 9 import 'package:analysis_server/src/edit/edit_domain.dart';
10 import 'package:analyzer_plugin/protocol/protocol_common.dart'; 10 import 'package:analyzer_plugin/protocol/protocol_common.dart';
(...skipping 26 matching lines...) Expand all
37 test_function() { 37 test_function() {
38 addTestFile(''' 38 addTestFile('''
39 int get test => 42; 39 int get test => 42;
40 main() { 40 main() {
41 var a = 1 + test; 41 var a = 1 + test;
42 var b = 2 + test; 42 var b = 2 + test;
43 } 43 }
44 '''); 44 ''');
45 return assertSuccessfulRefactoring(() { 45 return assertSuccessfulRefactoring(() {
46 return _sendConvertRequest('test =>'); 46 return _sendConvertRequest('test =>');
47 }, 47 }, '''
48 '''
49 int test() => 42; 48 int test() => 42;
50 main() { 49 main() {
51 var a = 1 + test(); 50 var a = 1 + test();
52 var b = 2 + test(); 51 var b = 2 + test();
53 } 52 }
54 '''); 53 ''');
55 } 54 }
56 55
57 test_init_fatalError_notExplicit() { 56 test_init_fatalError_notExplicit() {
58 addTestFile(''' 57 addTestFile('''
(...skipping 28 matching lines...) Expand all
87 } 86 }
88 main(A a, B b, C c, D d) { 87 main(A a, B b, C c, D d) {
89 var va = a.test; 88 var va = a.test;
90 var vb = b.test; 89 var vb = b.test;
91 var vc = c.test; 90 var vc = c.test;
92 var vd = d.test; 91 var vd = d.test;
93 } 92 }
94 '''); 93 ''');
95 return assertSuccessfulRefactoring(() { 94 return assertSuccessfulRefactoring(() {
96 return _sendConvertRequest('test => 2'); 95 return _sendConvertRequest('test => 2');
97 }, 96 }, '''
98 '''
99 class A { 97 class A {
100 int test() => 1; 98 int test() => 1;
101 } 99 }
102 class B extends A { 100 class B extends A {
103 int test() => 2; 101 int test() => 2;
104 } 102 }
105 class C extends B { 103 class C extends B {
106 int test() => 3; 104 int test() => 3;
107 } 105 }
108 class D extends A { 106 class D extends A {
(...skipping 25 matching lines...) Expand all
134 test_function() { 132 test_function() {
135 addTestFile(''' 133 addTestFile('''
136 int test() => 42; 134 int test() => 42;
137 main() { 135 main() {
138 var a = 1 + test(); 136 var a = 1 + test();
139 var b = 2 + test(); 137 var b = 2 + test();
140 } 138 }
141 '''); 139 ''');
142 return assertSuccessfulRefactoring(() { 140 return assertSuccessfulRefactoring(() {
143 return _sendConvertRequest('test() =>'); 141 return _sendConvertRequest('test() =>');
144 }, 142 }, '''
145 '''
146 int get test => 42; 143 int get test => 42;
147 main() { 144 main() {
148 var a = 1 + test; 145 var a = 1 + test;
149 var b = 2 + test; 146 var b = 2 + test;
150 } 147 }
151 '''); 148 ''');
152 } 149 }
153 150
154 test_init_fatalError_hasParameters() { 151 test_init_fatalError_hasParameters() {
155 addTestFile(''' 152 addTestFile('''
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 198 }
202 main(A a, B b, C c, D d) { 199 main(A a, B b, C c, D d) {
203 var va = a.test(); 200 var va = a.test();
204 var vb = b.test(); 201 var vb = b.test();
205 var vc = c.test(); 202 var vc = c.test();
206 var vd = d.test(); 203 var vd = d.test();
207 } 204 }
208 '''); 205 ''');
209 return assertSuccessfulRefactoring(() { 206 return assertSuccessfulRefactoring(() {
210 return _sendConvertRequest('test() => 2'); 207 return _sendConvertRequest('test() => 2');
211 }, 208 }, '''
212 '''
213 class A { 209 class A {
214 int get test => 1; 210 int get test => 1;
215 } 211 }
216 class B extends A { 212 class B extends A {
217 int get test => 2; 213 int get test => 2;
218 } 214 }
219 class C extends B { 215 class C extends B {
220 int get test => 3; 216 int get test => 3;
221 } 217 }
222 class D extends A { 218 class D extends A {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 void tearDown() { 266 void tearDown() {
271 test_simulateRefactoringException_init = false; 267 test_simulateRefactoringException_init = false;
272 test_simulateRefactoringException_final = false; 268 test_simulateRefactoringException_final = false;
273 test_simulateRefactoringException_change = false; 269 test_simulateRefactoringException_change = false;
274 super.tearDown(); 270 super.tearDown();
275 } 271 }
276 272
277 test_analysis_onlyOneFile() async { 273 test_analysis_onlyOneFile() async {
278 shouldWaitForFullAnalysis = false; 274 shouldWaitForFullAnalysis = false;
279 String otherFile = '$testFolder/other.dart'; 275 String otherFile = '$testFolder/other.dart';
280 addFile( 276 addFile(otherFile, r'''
281 otherFile,
282 r'''
283 foo(int myName) {} 277 foo(int myName) {}
284 '''); 278 ''');
285 addTestFile(''' 279 addTestFile('''
286 import 'other.dart'; 280 import 'other.dart';
287 main() { 281 main() {
288 foo(1 + 2); 282 foo(1 + 2);
289 } 283 }
290 '''); 284 ''');
291 // Start refactoring. 285 // Start refactoring.
292 EditGetRefactoringResult result = await getRefactoringResult(() { 286 EditGetRefactoringResult result = await getRefactoringResult(() {
(...skipping 26 matching lines...) Expand all
319 313
320 test_extractAll() { 314 test_extractAll() {
321 addTestFile(''' 315 addTestFile('''
322 main() { 316 main() {
323 print(1 + 2); 317 print(1 + 2);
324 print(1 + 2); 318 print(1 + 2);
325 } 319 }
326 '''); 320 ''');
327 return assertSuccessfulRefactoring(() { 321 return assertSuccessfulRefactoring(() {
328 return sendStringRequest('1 + 2', 'res', true); 322 return sendStringRequest('1 + 2', 'res', true);
329 }, 323 }, '''
330 '''
331 main() { 324 main() {
332 var res = 1 + 2; 325 var res = 1 + 2;
333 print(res); 326 print(res);
334 print(res); 327 print(res);
335 } 328 }
336 '''); 329 ''');
337 } 330 }
338 331
339 test_extractOne() { 332 test_extractOne() {
340 addTestFile(''' 333 addTestFile('''
341 main() { 334 main() {
342 print(1 + 2); 335 print(1 + 2);
343 print(1 + 2); // marker 336 print(1 + 2); // marker
344 } 337 }
345 '''); 338 ''');
346 return assertSuccessfulRefactoring(() { 339 return assertSuccessfulRefactoring(() {
347 return sendStringSuffixRequest('1 + 2', '); // marker', 'res', false); 340 return sendStringSuffixRequest('1 + 2', '); // marker', 'res', false);
348 }, 341 }, '''
349 '''
350 main() { 342 main() {
351 print(1 + 2); 343 print(1 + 2);
352 var res = 1 + 2; 344 var res = 1 + 2;
353 print(res); // marker 345 print(res); // marker
354 } 346 }
355 '''); 347 ''');
356 } 348 }
357 349
358 test_names() async { 350 test_names() async {
359 addTestFile(''' 351 addTestFile('''
(...skipping 17 matching lines...) Expand all
377 main() { 369 main() {
378 print(1 + 2); 370 print(1 + 2);
379 } 371 }
380 '''); 372 ''');
381 EditGetRefactoringResult result = await getRefactoringResult(() { 373 EditGetRefactoringResult result = await getRefactoringResult(() {
382 return sendStringRequest('1 + 2', 'Name', true); 374 return sendStringRequest('1 + 2', 'Name', true);
383 }); 375 });
384 assertResultProblemsWarning(result.optionsProblems, 376 assertResultProblemsWarning(result.optionsProblems,
385 'Variable name should start with a lowercase letter.'); 377 'Variable name should start with a lowercase letter.');
386 // ...but there is still a change 378 // ...but there is still a change
387 assertTestRefactoringResult( 379 assertTestRefactoringResult(result, '''
388 result,
389 '''
390 main() { 380 main() {
391 var Name = 1 + 2; 381 var Name = 1 + 2;
392 print(Name); 382 print(Name);
393 } 383 }
394 '''); 384 ''');
395 } 385 }
396 386
397 test_offsetsLengths() { 387 test_offsetsLengths() {
398 addTestFile(''' 388 addTestFile('''
399 main() { 389 main() {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 ExtractMethodOptions options; 500 ExtractMethodOptions options;
511 501
512 test_expression() { 502 test_expression() {
513 addTestFile(''' 503 addTestFile('''
514 main() { 504 main() {
515 print(1 + 2); 505 print(1 + 2);
516 print(1 + 2); 506 print(1 + 2);
517 } 507 }
518 '''); 508 ''');
519 _setOffsetLengthForString('1 + 2'); 509 _setOffsetLengthForString('1 + 2');
520 return assertSuccessfulRefactoring( 510 return assertSuccessfulRefactoring(_computeChange, '''
521 _computeChange,
522 '''
523 main() { 511 main() {
524 print(res()); 512 print(res());
525 print(res()); 513 print(res());
526 } 514 }
527 515
528 int res() => 1 + 2; 516 int res() => 1 + 2;
529 '''); 517 ''');
530 } 518 }
531 519
532 test_expression_hasParameters() { 520 test_expression_hasParameters() {
533 addTestFile(''' 521 addTestFile('''
534 main() { 522 main() {
535 int a = 1; 523 int a = 1;
536 int b = 2; 524 int b = 2;
537 print(a + b); 525 print(a + b);
538 print(a + b); 526 print(a + b);
539 } 527 }
540 '''); 528 ''');
541 _setOffsetLengthForString('a + b'); 529 _setOffsetLengthForString('a + b');
542 return assertSuccessfulRefactoring( 530 return assertSuccessfulRefactoring(_computeChange, '''
543 _computeChange,
544 '''
545 main() { 531 main() {
546 int a = 1; 532 int a = 1;
547 int b = 2; 533 int b = 2;
548 print(res(a, b)); 534 print(res(a, b));
549 print(res(a, b)); 535 print(res(a, b));
550 } 536 }
551 537
552 int res(int a, int b) => a + b; 538 int res(int a, int b) => a + b;
553 '''); 539 ''');
554 } 540 }
555 541
556 test_expression_updateParameters() { 542 test_expression_updateParameters() {
557 addTestFile(''' 543 addTestFile('''
558 main() { 544 main() {
559 int a = 1; 545 int a = 1;
560 int b = 2; 546 int b = 2;
561 print(a + b); 547 print(a + b);
562 print(a + b); 548 print(a + b);
563 } 549 }
564 '''); 550 ''');
565 _setOffsetLengthForString('a + b'); 551 _setOffsetLengthForString('a + b');
566 return getRefactoringResult(_computeChange).then((result) { 552 return getRefactoringResult(_computeChange).then((result) {
567 ExtractMethodFeedback feedback = result.feedback; 553 ExtractMethodFeedback feedback = result.feedback;
568 List<RefactoringMethodParameter> parameters = feedback.parameters; 554 List<RefactoringMethodParameter> parameters = feedback.parameters;
569 parameters[0].name = 'aaa'; 555 parameters[0].name = 'aaa';
570 parameters[1].name = 'bbb'; 556 parameters[1].name = 'bbb';
571 parameters[1].type = 'num'; 557 parameters[1].type = 'num';
572 parameters.insert(0, parameters.removeLast()); 558 parameters.insert(0, parameters.removeLast());
573 options.parameters = parameters; 559 options.parameters = parameters;
574 return assertSuccessfulRefactoring( 560 return assertSuccessfulRefactoring(_sendExtractRequest, '''
575 _sendExtractRequest,
576 '''
577 main() { 561 main() {
578 int a = 1; 562 int a = 1;
579 int b = 2; 563 int b = 2;
580 print(res(b, a)); 564 print(res(b, a));
581 print(res(b, a)); 565 print(res(b, a));
582 } 566 }
583 567
584 int res(num bbb, int aaa) => aaa + bbb; 568 int res(num bbb, int aaa) => aaa + bbb;
585 '''); 569 ''');
586 }); 570 });
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 main() { 629 main() {
646 int a = 1; 630 int a = 1;
647 int b = 2; 631 int b = 2;
648 // start 632 // start
649 print(a + b); 633 print(a + b);
650 // end 634 // end
651 print(a + b); 635 print(a + b);
652 } 636 }
653 '''); 637 ''');
654 _setOffsetLengthForStartEnd(); 638 _setOffsetLengthForStartEnd();
655 return assertSuccessfulRefactoring( 639 return assertSuccessfulRefactoring(_computeChange, '''
656 _computeChange,
657 '''
658 main() { 640 main() {
659 int a = 1; 641 int a = 1;
660 int b = 2; 642 int b = 2;
661 // start 643 // start
662 res(a, b); 644 res(a, b);
663 // end 645 // end
664 res(a, b); 646 res(a, b);
665 } 647 }
666 648
667 void res(int a, int b) { 649 void res(int a, int b) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 void setUp() { 755 void setUp() {
774 super.setUp(); 756 super.setUp();
775 createProject(); 757 createProject();
776 ExtensionManager manager = new ExtensionManager(); 758 ExtensionManager manager = new ExtensionManager();
777 manager.processPlugins([server.serverPlugin]); 759 manager.processPlugins([server.serverPlugin]);
778 handler = new EditDomainHandler(server); 760 handler = new EditDomainHandler(server);
779 server.handlers = [handler]; 761 server.handlers = [handler];
780 } 762 }
781 763
782 Future test_convertMethodToGetter_hasElement() { 764 Future test_convertMethodToGetter_hasElement() {
783 return assertHasKind( 765 return assertHasKind('''
784 '''
785 int getValue() => 42; 766 int getValue() => 42;
786 ''', 767 ''', 'getValue', RefactoringKind.CONVERT_METHOD_TO_GETTER, true);
787 'getValue',
788 RefactoringKind.CONVERT_METHOD_TO_GETTER,
789 true);
790 } 768 }
791 769
792 Future test_extractLocal() async { 770 Future test_extractLocal() async {
793 addTestFile(''' 771 addTestFile('''
794 main() { 772 main() {
795 var a = 1 + 2; 773 var a = 1 + 2;
796 } 774 }
797 '''); 775 ''');
798 await waitForTasksFinished(); 776 await waitForTasksFinished();
799 await getRefactoringsForString('1 + 2'); 777 await getRefactoringsForString('1 + 2');
800 expect(kinds, contains(RefactoringKind.EXTRACT_LOCAL_VARIABLE)); 778 expect(kinds, contains(RefactoringKind.EXTRACT_LOCAL_VARIABLE));
801 expect(kinds, contains(RefactoringKind.EXTRACT_METHOD)); 779 expect(kinds, contains(RefactoringKind.EXTRACT_METHOD));
802 } 780 }
803 781
804 Future test_rename_hasElement_class() { 782 Future test_rename_hasElement_class() {
805 return assertHasRenameRefactoring( 783 return assertHasRenameRefactoring('''
806 '''
807 class Test {} 784 class Test {}
808 main() { 785 main() {
809 Test v; 786 Test v;
810 } 787 }
811 ''', 788 ''', 'Test v');
812 'Test v');
813 } 789 }
814 790
815 Future test_rename_hasElement_constructor() { 791 Future test_rename_hasElement_constructor() {
816 return assertHasRenameRefactoring( 792 return assertHasRenameRefactoring('''
817 '''
818 class A { 793 class A {
819 A.test() {} 794 A.test() {}
820 } 795 }
821 main() { 796 main() {
822 new A.test(); 797 new A.test();
823 } 798 }
824 ''', 799 ''', 'test();');
825 'test();');
826 } 800 }
827 801
828 Future test_rename_hasElement_function() { 802 Future test_rename_hasElement_function() {
829 return assertHasRenameRefactoring( 803 return assertHasRenameRefactoring('''
830 '''
831 main() { 804 main() {
832 test(); 805 test();
833 } 806 }
834 test() {} 807 test() {}
835 ''', 808 ''', 'test();');
836 'test();');
837 } 809 }
838 810
839 Future test_rename_hasElement_importElement_directive() { 811 Future test_rename_hasElement_importElement_directive() {
840 return assertHasRenameRefactoring( 812 return assertHasRenameRefactoring('''
841 '''
842 import 'dart:math' as math; 813 import 'dart:math' as math;
843 main() { 814 main() {
844 math.PI; 815 math.PI;
845 } 816 }
846 ''', 817 ''', 'import ');
847 'import ');
848 } 818 }
849 819
850 Future test_rename_hasElement_importElement_prefixDecl() { 820 Future test_rename_hasElement_importElement_prefixDecl() {
851 return assertHasRenameRefactoring( 821 return assertHasRenameRefactoring('''
852 '''
853 import 'dart:math' as math; 822 import 'dart:math' as math;
854 main() { 823 main() {
855 math.PI; 824 math.PI;
856 } 825 }
857 ''', 826 ''', 'math;');
858 'math;');
859 } 827 }
860 828
861 Future test_rename_hasElement_importElement_prefixRef() { 829 Future test_rename_hasElement_importElement_prefixRef() {
862 return assertHasRenameRefactoring( 830 return assertHasRenameRefactoring('''
863 '''
864 import 'dart:async' as test; 831 import 'dart:async' as test;
865 import 'dart:math' as test; 832 import 'dart:math' as test;
866 main() { 833 main() {
867 test.PI; 834 test.PI;
868 } 835 }
869 ''', 836 ''', 'test.PI;');
870 'test.PI;');
871 } 837 }
872 838
873 Future test_rename_hasElement_instanceGetter() { 839 Future test_rename_hasElement_instanceGetter() {
874 return assertHasRenameRefactoring( 840 return assertHasRenameRefactoring('''
875 '''
876 class A { 841 class A {
877 get test => 0; 842 get test => 0;
878 } 843 }
879 main(A a) { 844 main(A a) {
880 a.test; 845 a.test;
881 } 846 }
882 ''', 847 ''', 'test;');
883 'test;');
884 } 848 }
885 849
886 Future test_rename_hasElement_instanceSetter() { 850 Future test_rename_hasElement_instanceSetter() {
887 return assertHasRenameRefactoring( 851 return assertHasRenameRefactoring('''
888 '''
889 class A { 852 class A {
890 set test(x) {} 853 set test(x) {}
891 } 854 }
892 main(A a) { 855 main(A a) {
893 a.test = 2; 856 a.test = 2;
894 } 857 }
895 ''', 858 ''', 'test = 2;');
896 'test = 2;');
897 } 859 }
898 860
899 Future test_rename_hasElement_library() { 861 Future test_rename_hasElement_library() {
900 return assertHasRenameRefactoring( 862 return assertHasRenameRefactoring('''
901 '''
902 library my.lib; 863 library my.lib;
903 ''', 864 ''', 'library ');
904 'library ');
905 } 865 }
906 866
907 Future test_rename_hasElement_localVariable() { 867 Future test_rename_hasElement_localVariable() {
908 return assertHasRenameRefactoring( 868 return assertHasRenameRefactoring('''
909 '''
910 main() { 869 main() {
911 int test = 0; 870 int test = 0;
912 print(test); 871 print(test);
913 } 872 }
914 ''', 873 ''', 'test = 0;');
915 'test = 0;');
916 } 874 }
917 875
918 Future test_rename_hasElement_method() { 876 Future test_rename_hasElement_method() {
919 return assertHasRenameRefactoring( 877 return assertHasRenameRefactoring('''
920 '''
921 class A { 878 class A {
922 test() {} 879 test() {}
923 } 880 }
924 main(A a) { 881 main(A a) {
925 a.test(); 882 a.test();
926 } 883 }
927 ''', 884 ''', 'test();');
928 'test();');
929 } 885 }
930 886
931 Future test_rename_noElement() async { 887 Future test_rename_noElement() async {
932 addTestFile(''' 888 addTestFile('''
933 main() { 889 main() {
934 // not an element 890 // not an element
935 } 891 }
936 '''); 892 ''');
937 await waitForTasksFinished(); 893 await waitForTasksFinished();
938 await getRefactoringsAtString('// not an element'); 894 await getRefactoringsAtString('// not an element');
939 expect(kinds, isNot(contains(RefactoringKind.RENAME))); 895 expect(kinds, isNot(contains(RefactoringKind.RENAME)));
940 } 896 }
941 } 897 }
942 898
943 @reflectiveTest 899 @reflectiveTest
944 class InlineLocalTest extends _AbstractGetRefactoring_Test { 900 class InlineLocalTest extends _AbstractGetRefactoring_Test {
945 test_analysis_onlyOneFile() async { 901 test_analysis_onlyOneFile() async {
946 shouldWaitForFullAnalysis = false; 902 shouldWaitForFullAnalysis = false;
947 String otherFile = '$testFolder/other.dart'; 903 String otherFile = '$testFolder/other.dart';
948 addFile( 904 addFile(otherFile, r'''
949 otherFile,
950 r'''
951 foo(int p) {} 905 foo(int p) {}
952 '''); 906 ''');
953 addTestFile(''' 907 addTestFile('''
954 import 'other.dart'; 908 import 'other.dart';
955 main() { 909 main() {
956 int res = 1 + 2; 910 int res = 1 + 2;
957 foo(res); 911 foo(res);
958 foo(res); 912 foo(res);
959 } 913 }
960 '''); 914 ''');
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 test_OK() { 953 test_OK() {
1000 addTestFile(''' 954 addTestFile('''
1001 main() { 955 main() {
1002 int test = 42; 956 int test = 42;
1003 int a = test + 2; 957 int a = test + 2;
1004 print(test); 958 print(test);
1005 } 959 }
1006 '''); 960 ''');
1007 return assertSuccessfulRefactoring(() { 961 return assertSuccessfulRefactoring(() {
1008 return _sendInlineRequest('test + 2'); 962 return _sendInlineRequest('test + 2');
1009 }, 963 }, '''
1010 '''
1011 main() { 964 main() {
1012 int a = 42 + 2; 965 int a = 42 + 2;
1013 print(42); 966 print(42);
1014 } 967 }
1015 '''); 968 ''');
1016 } 969 }
1017 970
1018 @failingTest 971 @failingTest
1019 test_resetOnFileChange() async { 972 test_resetOnFileChange() async {
1020 // The reset count is one less than expected. 973 // The reset count is one less than expected.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 main() { 1060 main() {
1108 test(1); 1061 test(1);
1109 } 1062 }
1110 } 1063 }
1111 main(A a) { 1064 main(A a) {
1112 a.test(2); 1065 a.test(2);
1113 } 1066 }
1114 '''); 1067 ''');
1115 return assertSuccessfulRefactoring(() { 1068 return assertSuccessfulRefactoring(() {
1116 return _sendInlineRequest('test(int p)'); 1069 return _sendInlineRequest('test(int p)');
1117 }, 1070 }, '''
1118 '''
1119 class A { 1071 class A {
1120 int f; 1072 int f;
1121 main() { 1073 main() {
1122 print(f + 1); 1074 print(f + 1);
1123 } 1075 }
1124 } 1076 }
1125 main(A a) { 1077 main(A a) {
1126 print(a.f + 2); 1078 print(a.f + 2);
1127 } 1079 }
1128 '''); 1080 ''');
1129 } 1081 }
1130 1082
1131 test_topLevelFunction() { 1083 test_topLevelFunction() {
1132 addTestFile(''' 1084 addTestFile('''
1133 test(a, b) { 1085 test(a, b) {
1134 print(a + b); 1086 print(a + b);
1135 } 1087 }
1136 main() { 1088 main() {
1137 test(1, 2); 1089 test(1, 2);
1138 test(10, 20); 1090 test(10, 20);
1139 } 1091 }
1140 '''); 1092 ''');
1141 return assertSuccessfulRefactoring(() { 1093 return assertSuccessfulRefactoring(() {
1142 return _sendInlineRequest('test(a'); 1094 return _sendInlineRequest('test(a');
1143 }, 1095 }, '''
1144 '''
1145 main() { 1096 main() {
1146 print(1 + 2); 1097 print(1 + 2);
1147 print(10 + 20); 1098 print(10 + 20);
1148 } 1099 }
1149 '''); 1100 ''');
1150 } 1101 }
1151 1102
1152 test_topLevelFunction_oneInvocation() { 1103 test_topLevelFunction_oneInvocation() {
1153 addTestFile(''' 1104 addTestFile('''
1154 test(a, b) { 1105 test(a, b) {
1155 print(a + b); 1106 print(a + b);
1156 } 1107 }
1157 main() { 1108 main() {
1158 test(1, 2); 1109 test(1, 2);
1159 test(10, 20); 1110 test(10, 20);
1160 } 1111 }
1161 '''); 1112 ''');
1162 options.deleteSource = false; 1113 options.deleteSource = false;
1163 options.inlineAll = false; 1114 options.inlineAll = false;
1164 return assertSuccessfulRefactoring(() { 1115 return assertSuccessfulRefactoring(() {
1165 return _sendInlineRequest('test(10,'); 1116 return _sendInlineRequest('test(10,');
1166 }, 1117 }, '''
1167 '''
1168 test(a, b) { 1118 test(a, b) {
1169 print(a + b); 1119 print(a + b);
1170 } 1120 }
1171 main() { 1121 main() {
1172 test(1, 2); 1122 test(1, 2);
1173 print(10 + 20); 1123 print(10 + 20);
1174 } 1124 }
1175 '''); 1125 ''');
1176 } 1126 }
1177 1127
(...skipping 18 matching lines...) Expand all
1196 test_OK() { 1146 test_OK() {
1197 fail('The move file refactoring is not supported under the new driver'); 1147 fail('The move file refactoring is not supported under the new driver');
1198 resourceProvider.newFile('/project/bin/lib.dart', ''); 1148 resourceProvider.newFile('/project/bin/lib.dart', '');
1199 addTestFile(''' 1149 addTestFile('''
1200 import 'dart:math'; 1150 import 'dart:math';
1201 import 'lib.dart'; 1151 import 'lib.dart';
1202 '''); 1152 ''');
1203 _setOptions('/project/test.dart'); 1153 _setOptions('/project/test.dart');
1204 return assertSuccessfulRefactoring(() { 1154 return assertSuccessfulRefactoring(() {
1205 return _sendMoveRequest(); 1155 return _sendMoveRequest();
1206 }, 1156 }, '''
1207 '''
1208 import 'dart:math'; 1157 import 'dart:math';
1209 import 'bin/lib.dart'; 1158 import 'bin/lib.dart';
1210 '''); 1159 ''');
1211 } 1160 }
1212 1161
1213 Future<Response> _sendMoveRequest() { 1162 Future<Response> _sendMoveRequest() {
1214 Request request = new EditGetRefactoringParams( 1163 Request request = new EditGetRefactoringParams(
1215 RefactoringKind.MOVE_FILE, testFile, 0, 0, false, 1164 RefactoringKind.MOVE_FILE, testFile, 0, 0, false,
1216 options: options) 1165 options: options)
1217 .toRequest('0'); 1166 .toRequest('0');
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 Test.named() {} 1218 Test.named() {}
1270 } 1219 }
1271 main() { 1220 main() {
1272 Test v; 1221 Test v;
1273 new Test(); 1222 new Test();
1274 new Test.named(); 1223 new Test.named();
1275 } 1224 }
1276 '''); 1225 ''');
1277 return assertSuccessfulRefactoring(() { 1226 return assertSuccessfulRefactoring(() {
1278 return sendRenameRequest('Test {', 'NewName'); 1227 return sendRenameRequest('Test {', 'NewName');
1279 }, 1228 }, '''
1280 '''
1281 class NewName { 1229 class NewName {
1282 NewName() {} 1230 NewName() {}
1283 NewName.named() {} 1231 NewName.named() {}
1284 } 1232 }
1285 main() { 1233 main() {
1286 NewName v; 1234 NewName v;
1287 new NewName(); 1235 new NewName();
1288 new NewName.named(); 1236 new NewName.named();
1289 } 1237 }
1290 '''); 1238 ''');
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 main() { 1279 main() {
1332 Test v; 1280 Test v;
1333 } 1281 }
1334 '''); 1282 ''');
1335 return getRefactoringResult(() { 1283 return getRefactoringResult(() {
1336 return sendRenameRequest('Test {}', 'newName'); 1284 return sendRenameRequest('Test {}', 'newName');
1337 }).then((result) { 1285 }).then((result) {
1338 assertResultProblemsWarning(result.optionsProblems, 1286 assertResultProblemsWarning(result.optionsProblems,
1339 'Class name should start with an uppercase letter.'); 1287 'Class name should start with an uppercase letter.');
1340 // ...but there is still a change 1288 // ...but there is still a change
1341 assertTestRefactoringResult( 1289 assertTestRefactoringResult(result, '''
1342 result,
1343 '''
1344 class newName {} 1290 class newName {}
1345 main() { 1291 main() {
1346 newName v; 1292 newName v;
1347 } 1293 }
1348 '''); 1294 ''');
1349 }).then((_) { 1295 }).then((_) {
1350 // "NewName" is a perfectly valid name 1296 // "NewName" is a perfectly valid name
1351 return getRefactoringResult(() { 1297 return getRefactoringResult(() {
1352 return sendRenameRequest('Test {}', 'NewName'); 1298 return sendRenameRequest('Test {}', 'NewName');
1353 }).then((result) { 1299 }).then((result) {
1354 assertResultProblemsOK(result); 1300 assertResultProblemsOK(result);
1355 // ...and there is a new change 1301 // ...and there is a new change
1356 assertTestRefactoringResult( 1302 assertTestRefactoringResult(result, '''
1357 result,
1358 '''
1359 class NewName {} 1303 class NewName {}
1360 main() { 1304 main() {
1361 NewName v; 1305 NewName v;
1362 } 1306 }
1363 '''); 1307 ''');
1364 }); 1308 });
1365 }); 1309 });
1366 } 1310 }
1367 1311
1368 test_classMember_field() { 1312 test_classMember_field() {
1369 addTestFile(''' 1313 addTestFile('''
1370 class A { 1314 class A {
1371 var test = 0; 1315 var test = 0;
1372 A(this.test); 1316 A(this.test);
1373 main() { 1317 main() {
1374 print(test); 1318 print(test);
1375 } 1319 }
1376 } 1320 }
1377 '''); 1321 ''');
1378 return assertSuccessfulRefactoring(() { 1322 return assertSuccessfulRefactoring(() {
1379 return sendRenameRequest('test = 0', 'newName'); 1323 return sendRenameRequest('test = 0', 'newName');
1380 }, 1324 }, '''
1381 '''
1382 class A { 1325 class A {
1383 var newName = 0; 1326 var newName = 0;
1384 A(this.newName); 1327 A(this.newName);
1385 main() { 1328 main() {
1386 print(newName); 1329 print(newName);
1387 } 1330 }
1388 } 1331 }
1389 '''); 1332 ''');
1390 } 1333 }
1391 1334
1392 test_classMember_field_onFieldFormalParameter() { 1335 test_classMember_field_onFieldFormalParameter() {
1393 addTestFile(''' 1336 addTestFile('''
1394 class A { 1337 class A {
1395 var test = 0; 1338 var test = 0;
1396 A(this.test); 1339 A(this.test);
1397 main() { 1340 main() {
1398 print(test); 1341 print(test);
1399 } 1342 }
1400 } 1343 }
1401 '''); 1344 ''');
1402 return assertSuccessfulRefactoring(() { 1345 return assertSuccessfulRefactoring(() {
1403 return sendRenameRequest('test);', 'newName'); 1346 return sendRenameRequest('test);', 'newName');
1404 }, 1347 }, '''
1405 '''
1406 class A { 1348 class A {
1407 var newName = 0; 1349 var newName = 0;
1408 A(this.newName); 1350 A(this.newName);
1409 main() { 1351 main() {
1410 print(newName); 1352 print(newName);
1411 } 1353 }
1412 } 1354 }
1413 '''); 1355 ''');
1414 } 1356 }
1415 1357
1416 test_classMember_field_onFieldFormalParameter_named() { 1358 test_classMember_field_onFieldFormalParameter_named() {
1417 addTestFile(''' 1359 addTestFile('''
1418 class A { 1360 class A {
1419 final int test; 1361 final int test;
1420 A({this.test: 0}); 1362 A({this.test: 0});
1421 } 1363 }
1422 main() { 1364 main() {
1423 new A(test: 42); 1365 new A(test: 42);
1424 } 1366 }
1425 '''); 1367 ''');
1426 return assertSuccessfulRefactoring(() { 1368 return assertSuccessfulRefactoring(() {
1427 return sendRenameRequest('test: 42', 'newName'); 1369 return sendRenameRequest('test: 42', 'newName');
1428 }, 1370 }, '''
1429 '''
1430 class A { 1371 class A {
1431 final int newName; 1372 final int newName;
1432 A({this.newName: 0}); 1373 A({this.newName: 0});
1433 } 1374 }
1434 main() { 1375 main() {
1435 new A(newName: 42); 1376 new A(newName: 42);
1436 } 1377 }
1437 '''); 1378 ''');
1438 } 1379 }
1439 1380
1440 test_classMember_getter() { 1381 test_classMember_getter() {
1441 addTestFile(''' 1382 addTestFile('''
1442 class A { 1383 class A {
1443 get test => 0; 1384 get test => 0;
1444 main() { 1385 main() {
1445 print(test); 1386 print(test);
1446 } 1387 }
1447 } 1388 }
1448 '''); 1389 ''');
1449 return assertSuccessfulRefactoring(() { 1390 return assertSuccessfulRefactoring(() {
1450 return sendRenameRequest('test =>', 'newName'); 1391 return sendRenameRequest('test =>', 'newName');
1451 }, 1392 }, '''
1452 '''
1453 class A { 1393 class A {
1454 get newName => 0; 1394 get newName => 0;
1455 main() { 1395 main() {
1456 print(newName); 1396 print(newName);
1457 } 1397 }
1458 } 1398 }
1459 '''); 1399 ''');
1460 } 1400 }
1461 1401
1462 test_classMember_method() { 1402 test_classMember_method() {
1463 addTestFile(''' 1403 addTestFile('''
1464 class A { 1404 class A {
1465 test() {} 1405 test() {}
1466 main() { 1406 main() {
1467 test(); 1407 test();
1468 } 1408 }
1469 } 1409 }
1470 main(A a) { 1410 main(A a) {
1471 a.test(); 1411 a.test();
1472 } 1412 }
1473 '''); 1413 ''');
1474 return assertSuccessfulRefactoring(() { 1414 return assertSuccessfulRefactoring(() {
1475 return sendRenameRequest('test() {}', 'newName'); 1415 return sendRenameRequest('test() {}', 'newName');
1476 }, 1416 }, '''
1477 '''
1478 class A { 1417 class A {
1479 newName() {} 1418 newName() {}
1480 main() { 1419 main() {
1481 newName(); 1420 newName();
1482 } 1421 }
1483 } 1422 }
1484 main(A a) { 1423 main(A a) {
1485 a.newName(); 1424 a.newName();
1486 } 1425 }
1487 '''); 1426 ''');
(...skipping 30 matching lines...) Expand all
1518 addTestFile(''' 1457 addTestFile('''
1519 class A { 1458 class A {
1520 set test(x) {} 1459 set test(x) {}
1521 main() { 1460 main() {
1522 test = 0; 1461 test = 0;
1523 } 1462 }
1524 } 1463 }
1525 '''); 1464 ''');
1526 return assertSuccessfulRefactoring(() { 1465 return assertSuccessfulRefactoring(() {
1527 return sendRenameRequest('test = 0', 'newName'); 1466 return sendRenameRequest('test = 0', 'newName');
1528 }, 1467 }, '''
1529 '''
1530 class A { 1468 class A {
1531 set newName(x) {} 1469 set newName(x) {}
1532 main() { 1470 main() {
1533 newName = 0; 1471 newName = 0;
1534 } 1472 }
1535 } 1473 }
1536 '''); 1474 ''');
1537 } 1475 }
1538 1476
1539 test_constructor_fromFactoryRedirectingConstructor_onClassName() { 1477 test_constructor_fromFactoryRedirectingConstructor_onClassName() {
1540 addTestFile(''' 1478 addTestFile('''
1541 class A { 1479 class A {
1542 A() = B; 1480 A() = B;
1543 } 1481 }
1544 class B { 1482 class B {
1545 B() {} 1483 B() {}
1546 } 1484 }
1547 '''); 1485 ''');
1548 return assertSuccessfulRefactoring(() { 1486 return assertSuccessfulRefactoring(() {
1549 return sendRenameRequest('B;', 'newName'); 1487 return sendRenameRequest('B;', 'newName');
1550 }, 1488 }, '''
1551 '''
1552 class A { 1489 class A {
1553 A() = B.newName; 1490 A() = B.newName;
1554 } 1491 }
1555 class B { 1492 class B {
1556 B.newName() {} 1493 B.newName() {}
1557 } 1494 }
1558 '''); 1495 ''');
1559 } 1496 }
1560 1497
1561 test_constructor_fromInstanceCreation() { 1498 test_constructor_fromInstanceCreation() {
1562 addTestFile(''' 1499 addTestFile('''
1563 class A { 1500 class A {
1564 A.test() {} 1501 A.test() {}
1565 } 1502 }
1566 main() { 1503 main() {
1567 new A.test(); 1504 new A.test();
1568 } 1505 }
1569 '''); 1506 ''');
1570 return assertSuccessfulRefactoring(() { 1507 return assertSuccessfulRefactoring(() {
1571 return sendRenameRequest('test();', 'newName'); 1508 return sendRenameRequest('test();', 'newName');
1572 }, 1509 }, '''
1573 '''
1574 class A { 1510 class A {
1575 A.newName() {} 1511 A.newName() {}
1576 } 1512 }
1577 main() { 1513 main() {
1578 new A.newName(); 1514 new A.newName();
1579 } 1515 }
1580 '''); 1516 ''');
1581 } 1517 }
1582 1518
1583 test_constructor_fromInstanceCreation_default_onClassName() { 1519 test_constructor_fromInstanceCreation_default_onClassName() {
1584 addTestFile(''' 1520 addTestFile('''
1585 class A { 1521 class A {
1586 A() {} 1522 A() {}
1587 } 1523 }
1588 main() { 1524 main() {
1589 new A(); 1525 new A();
1590 } 1526 }
1591 '''); 1527 ''');
1592 return assertSuccessfulRefactoring(() { 1528 return assertSuccessfulRefactoring(() {
1593 return sendRenameRequest('A();', 'newName'); 1529 return sendRenameRequest('A();', 'newName');
1594 }, 1530 }, '''
1595 '''
1596 class A { 1531 class A {
1597 A.newName() {} 1532 A.newName() {}
1598 } 1533 }
1599 main() { 1534 main() {
1600 new A.newName(); 1535 new A.newName();
1601 } 1536 }
1602 '''); 1537 ''');
1603 } 1538 }
1604 1539
1605 test_constructor_fromInstanceCreation_default_onNew() { 1540 test_constructor_fromInstanceCreation_default_onNew() {
1606 addTestFile(''' 1541 addTestFile('''
1607 class A { 1542 class A {
1608 A() {} 1543 A() {}
1609 } 1544 }
1610 main() { 1545 main() {
1611 new A(); 1546 new A();
1612 } 1547 }
1613 '''); 1548 ''');
1614 return assertSuccessfulRefactoring(() { 1549 return assertSuccessfulRefactoring(() {
1615 return sendRenameRequest('new A();', 'newName'); 1550 return sendRenameRequest('new A();', 'newName');
1616 }, 1551 }, '''
1617 '''
1618 class A { 1552 class A {
1619 A.newName() {} 1553 A.newName() {}
1620 } 1554 }
1621 main() { 1555 main() {
1622 new A.newName(); 1556 new A.newName();
1623 } 1557 }
1624 '''); 1558 ''');
1625 } 1559 }
1626 1560
1627 test_feedback() { 1561 test_feedback() {
(...skipping 16 matching lines...) Expand all
1644 test_function() { 1578 test_function() {
1645 addTestFile(''' 1579 addTestFile('''
1646 test() {} 1580 test() {}
1647 main() { 1581 main() {
1648 test(); 1582 test();
1649 print(test); 1583 print(test);
1650 } 1584 }
1651 '''); 1585 ''');
1652 return assertSuccessfulRefactoring(() { 1586 return assertSuccessfulRefactoring(() {
1653 return sendRenameRequest('test() {}', 'newName'); 1587 return sendRenameRequest('test() {}', 'newName');
1654 }, 1588 }, '''
1655 '''
1656 newName() {} 1589 newName() {}
1657 main() { 1590 main() {
1658 newName(); 1591 newName();
1659 print(newName); 1592 print(newName);
1660 } 1593 }
1661 '''); 1594 ''');
1662 } 1595 }
1663 1596
1664 test_importPrefix_add() { 1597 test_importPrefix_add() {
1665 addTestFile(''' 1598 addTestFile('''
1666 import 'dart:math'; 1599 import 'dart:math';
1667 import 'dart:async'; 1600 import 'dart:async';
1668 main() { 1601 main() {
1669 Random r; 1602 Random r;
1670 Future f; 1603 Future f;
1671 } 1604 }
1672 '''); 1605 ''');
1673 return assertSuccessfulRefactoring(() { 1606 return assertSuccessfulRefactoring(() {
1674 return sendRenameRequest("import 'dart:async';", 'new_name'); 1607 return sendRenameRequest("import 'dart:async';", 'new_name');
1675 }, 1608 }, '''
1676 '''
1677 import 'dart:math'; 1609 import 'dart:math';
1678 import 'dart:async' as new_name; 1610 import 'dart:async' as new_name;
1679 main() { 1611 main() {
1680 Random r; 1612 Random r;
1681 new_name.Future f; 1613 new_name.Future f;
1682 } 1614 }
1683 '''); 1615 ''');
1684 } 1616 }
1685 1617
1686 test_importPrefix_remove() { 1618 test_importPrefix_remove() {
1687 addTestFile(''' 1619 addTestFile('''
1688 import 'dart:math' as test; 1620 import 'dart:math' as test;
1689 import 'dart:async' as test; 1621 import 'dart:async' as test;
1690 main() { 1622 main() {
1691 test.Random r; 1623 test.Random r;
1692 test.Future f; 1624 test.Future f;
1693 } 1625 }
1694 '''); 1626 ''');
1695 return assertSuccessfulRefactoring(() { 1627 return assertSuccessfulRefactoring(() {
1696 return sendRenameRequest("import 'dart:async' as test;", ''); 1628 return sendRenameRequest("import 'dart:async' as test;", '');
1697 }, 1629 }, '''
1698 '''
1699 import 'dart:math' as test; 1630 import 'dart:math' as test;
1700 import 'dart:async'; 1631 import 'dart:async';
1701 main() { 1632 main() {
1702 test.Random r; 1633 test.Random r;
1703 Future f; 1634 Future f;
1704 } 1635 }
1705 '''); 1636 ''');
1706 } 1637 }
1707 1638
1708 test_init_fatalError_noElement() { 1639 test_init_fatalError_noElement() {
1709 addTestFile('// nothing to rename'); 1640 addTestFile('// nothing to rename');
1710 return getRefactoringResult(() { 1641 return getRefactoringResult(() {
1711 return sendRenameRequest('// nothing', null); 1642 return sendRenameRequest('// nothing', null);
1712 }).then((result) { 1643 }).then((result) {
1713 assertResultProblemsFatal( 1644 assertResultProblemsFatal(
1714 result.initialProblems, 'Unable to create a refactoring'); 1645 result.initialProblems, 'Unable to create a refactoring');
1715 // ...there is no any change 1646 // ...there is no any change
1716 expect(result.change, isNull); 1647 expect(result.change, isNull);
1717 }); 1648 });
1718 } 1649 }
1719 1650
1720 test_library_libraryDirective() { 1651 test_library_libraryDirective() {
1721 addTestFile(''' 1652 addTestFile('''
1722 library aaa.bbb.ccc; 1653 library aaa.bbb.ccc;
1723 '''); 1654 ''');
1724 return assertSuccessfulRefactoring(() { 1655 return assertSuccessfulRefactoring(() {
1725 return sendRenameRequest('library aaa', 'my.new_name'); 1656 return sendRenameRequest('library aaa', 'my.new_name');
1726 }, 1657 }, '''
1727 '''
1728 library my.new_name; 1658 library my.new_name;
1729 '''); 1659 ''');
1730 } 1660 }
1731 1661
1732 test_library_libraryDirective_name() { 1662 test_library_libraryDirective_name() {
1733 addTestFile(''' 1663 addTestFile('''
1734 library aaa.bbb.ccc; 1664 library aaa.bbb.ccc;
1735 '''); 1665 ''');
1736 return assertSuccessfulRefactoring(() { 1666 return assertSuccessfulRefactoring(() {
1737 return sendRenameRequest('aaa', 'my.new_name'); 1667 return sendRenameRequest('aaa', 'my.new_name');
1738 }, 1668 }, '''
1739 '''
1740 library my.new_name; 1669 library my.new_name;
1741 '''); 1670 ''');
1742 } 1671 }
1743 1672
1744 test_library_libraryDirective_nameDot() { 1673 test_library_libraryDirective_nameDot() {
1745 addTestFile(''' 1674 addTestFile('''
1746 library aaa.bbb.ccc; 1675 library aaa.bbb.ccc;
1747 '''); 1676 ''');
1748 return assertSuccessfulRefactoring(() { 1677 return assertSuccessfulRefactoring(() {
1749 return sendRenameRequest('.bbb', 'my.new_name'); 1678 return sendRenameRequest('.bbb', 'my.new_name');
1750 }, 1679 }, '''
1751 '''
1752 library my.new_name; 1680 library my.new_name;
1753 '''); 1681 ''');
1754 } 1682 }
1755 1683
1756 test_library_partOfDirective() { 1684 test_library_partOfDirective() {
1757 addFile( 1685 addFile('$testFolder/my_lib.dart', '''
1758 '$testFolder/my_lib.dart',
1759 '''
1760 library aaa.bbb.ccc; 1686 library aaa.bbb.ccc;
1761 part 'test.dart'; 1687 part 'test.dart';
1762 '''); 1688 ''');
1763 addTestFile(''' 1689 addTestFile('''
1764 part of aaa.bbb.ccc; 1690 part of aaa.bbb.ccc;
1765 '''); 1691 ''');
1766 return assertSuccessfulRefactoring(() { 1692 return assertSuccessfulRefactoring(() {
1767 return sendRenameRequest('aaa.bb', 'my.new_name'); 1693 return sendRenameRequest('aaa.bb', 'my.new_name');
1768 }, 1694 }, '''
1769 '''
1770 part of my.new_name; 1695 part of my.new_name;
1771 '''); 1696 ''');
1772 } 1697 }
1773 1698
1774 test_localVariable() { 1699 test_localVariable() {
1775 addTestFile(''' 1700 addTestFile('''
1776 main() { 1701 main() {
1777 int test = 0; 1702 int test = 0;
1778 test = 1; 1703 test = 1;
1779 test += 2; 1704 test += 2;
1780 print(test); 1705 print(test);
1781 } 1706 }
1782 '''); 1707 ''');
1783 return assertSuccessfulRefactoring(() { 1708 return assertSuccessfulRefactoring(() {
1784 return sendRenameRequest('test = 1', 'newName'); 1709 return sendRenameRequest('test = 1', 'newName');
1785 }, 1710 }, '''
1786 '''
1787 main() { 1711 main() {
1788 int newName = 0; 1712 int newName = 0;
1789 newName = 1; 1713 newName = 1;
1790 newName += 2; 1714 newName += 2;
1791 print(newName); 1715 print(newName);
1792 } 1716 }
1793 '''); 1717 ''');
1794 } 1718 }
1795 1719
1796 test_localVariable_finalCheck_shadowError() { 1720 test_localVariable_finalCheck_shadowError() {
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 @override 1937 @override
2014 void setUp() { 1938 void setUp() {
2015 super.setUp(); 1939 super.setUp();
2016 createProject(); 1940 createProject();
2017 ExtensionManager manager = new ExtensionManager(); 1941 ExtensionManager manager = new ExtensionManager();
2018 manager.processPlugins([server.serverPlugin]); 1942 manager.processPlugins([server.serverPlugin]);
2019 handler = new EditDomainHandler(server); 1943 handler = new EditDomainHandler(server);
2020 server.handlers = [handler]; 1944 server.handlers = [handler];
2021 } 1945 }
2022 } 1946 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/edit/postfix_completion_test.dart ('k') | pkg/analysis_server/test/edit/sort_members_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698