| 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:analysis_server/src/services/correction/status.dart'; | 8 import 'package:analysis_server/src/services/correction/status.dart'; |
| 9 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 9 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 '''); | 50 '''); |
| 51 createRenameRefactoringAtString('test() {}'); | 51 createRenameRefactoringAtString('test() {}'); |
| 52 // check status | 52 // check status |
| 53 refactoring.newName = 'newName'; | 53 refactoring.newName = 'newName'; |
| 54 RefactoringStatus status = await refactoring.checkFinalConditions(); | 54 RefactoringStatus status = await refactoring.checkFinalConditions(); |
| 55 assertRefactoringStatusOK(status); | 55 assertRefactoringStatusOK(status); |
| 56 } | 56 } |
| 57 | 57 |
| 58 test_checkFinalConditions_publicToPrivate_usedInOtherLibrary() async { |
| 59 indexTestUnit(''' |
| 60 class A { |
| 61 test() {} |
| 62 } |
| 63 '''); |
| 64 indexUnit('/lib.dart', ''' |
| 65 library my.lib; |
| 66 import 'test.dart'; |
| 67 |
| 68 main(A a) { |
| 69 a.test(); |
| 70 } |
| 71 '''); |
| 72 createRenameRefactoringAtString('test() {}'); |
| 73 // check status |
| 74 refactoring.newName = '_newName'; |
| 75 RefactoringStatus status = await refactoring.checkFinalConditions(); |
| 76 assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR, |
| 77 expectedMessage: "Renamed method will be invisible in 'my.lib'."); |
| 78 } |
| 79 |
| 58 test_checkFinalConditions_shadowed_byLocal_inSameClass() async { | 80 test_checkFinalConditions_shadowed_byLocal_inSameClass() async { |
| 59 indexTestUnit(''' | 81 indexTestUnit(''' |
| 60 class A { | 82 class A { |
| 61 test() {} | 83 test() {} |
| 62 main() { | 84 main() { |
| 63 var newName; | 85 var newName; |
| 64 test(); // marker | 86 test(); // marker |
| 65 } | 87 } |
| 66 } | 88 } |
| 67 '''); | 89 '''); |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 // validate change | 719 // validate change |
| 698 return assertSuccessfulRefactoring(''' | 720 return assertSuccessfulRefactoring(''' |
| 699 class A<NewName> { | 721 class A<NewName> { |
| 700 NewName field; | 722 NewName field; |
| 701 List<NewName> items; | 723 List<NewName> items; |
| 702 NewName method(NewName p) => null; | 724 NewName method(NewName p) => null; |
| 703 } | 725 } |
| 704 '''); | 726 '''); |
| 705 } | 727 } |
| 706 } | 728 } |
| OLD | NEW |