| OLD | NEW |
| 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.refactoring.rename_class_member; | 5 library test.services.refactoring.rename_class_member; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/protocol.dart'; | 7 import 'package:analysis_server/src/protocol.dart'; |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 | 9 |
| 10 import '../../reflective_tests.dart'; | 10 import '../../reflective_tests.dart'; |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 refactoring.newName = 'newName'; | 402 refactoring.newName = 'newName'; |
| 403 // validate change | 403 // validate change |
| 404 return assertSuccessfulRefactoring(''' | 404 return assertSuccessfulRefactoring(''' |
| 405 class A { | 405 class A { |
| 406 final newName; | 406 final newName; |
| 407 A(this.newName); | 407 A(this.newName); |
| 408 } | 408 } |
| 409 '''); | 409 '''); |
| 410 } | 410 } |
| 411 | 411 |
| 412 test_createChange_FieldElement_fieldFormalParameter_named() { |
| 413 indexTestUnit(''' |
| 414 class A { |
| 415 final test; |
| 416 A({this.test}); |
| 417 } |
| 418 main() { |
| 419 new A(test: 42); |
| 420 } |
| 421 '''); |
| 422 // configure refactoring |
| 423 createRenameRefactoringAtString('test;'); |
| 424 expect(refactoring.refactoringName, 'Rename Field'); |
| 425 expect(refactoring.oldName, 'test'); |
| 426 refactoring.newName = 'newName'; |
| 427 // validate change |
| 428 return assertSuccessfulRefactoring(''' |
| 429 class A { |
| 430 final newName; |
| 431 A({this.newName}); |
| 432 } |
| 433 main() { |
| 434 new A(newName: 42); |
| 435 } |
| 436 '''); |
| 437 } |
| 438 |
| 412 test_createChange_FieldElement_invocation() { | 439 test_createChange_FieldElement_invocation() { |
| 413 indexTestUnit(''' | 440 indexTestUnit(''' |
| 414 typedef F(a); | 441 typedef F(a); |
| 415 class A { | 442 class A { |
| 416 F test; | 443 F test; |
| 417 main() { | 444 main() { |
| 418 test(1); | 445 test(1); |
| 419 } | 446 } |
| 420 } | 447 } |
| 421 main() { | 448 main() { |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 // validate change | 732 // validate change |
| 706 return assertSuccessfulRefactoring(''' | 733 return assertSuccessfulRefactoring(''' |
| 707 class A<NewName> { | 734 class A<NewName> { |
| 708 NewName field; | 735 NewName field; |
| 709 List<NewName> items; | 736 List<NewName> items; |
| 710 NewName method(NewName p) => null; | 737 NewName method(NewName p) => null; |
| 711 } | 738 } |
| 712 '''); | 739 '''); |
| 713 } | 740 } |
| 714 } | 741 } |
| OLD | NEW |