| 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/plugin/protocol/protocol.dart'; | 7 import 'package:analysis_server/plugin/protocol/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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 83     createRenameRefactoringAtString('test() {}'); | 83     createRenameRefactoringAtString('test() {}'); | 
| 84     // check status | 84     // check status | 
| 85     refactoring.newName = 'newName'; | 85     refactoring.newName = 'newName'; | 
| 86     RefactoringStatus status = await refactoring.checkFinalConditions(); | 86     RefactoringStatus status = await refactoring.checkFinalConditions(); | 
| 87     assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR, | 87     assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR, | 
| 88         expectedMessage: | 88         expectedMessage: | 
| 89             "Class 'A' already declares method with name 'newName'.", | 89             "Class 'A' already declares method with name 'newName'.", | 
| 90         expectedContextSearch: 'newName() {} // existing'); | 90         expectedContextSearch: 'newName() {} // existing'); | 
| 91   } | 91   } | 
| 92 | 92 | 
|  | 93   test_checkFinalConditions_OK_dropSuffix() async { | 
|  | 94     indexTestUnit(r''' | 
|  | 95 abstract class A { | 
|  | 96   void testOld(); | 
|  | 97 } | 
|  | 98 class B implements A { | 
|  | 99   void testOld() {} | 
|  | 100 } | 
|  | 101 '''); | 
|  | 102     createRenameRefactoringAtString('testOld() {}'); | 
|  | 103     // check status | 
|  | 104     refactoring.newName = 'test'; | 
|  | 105     RefactoringStatus status = await refactoring.checkFinalConditions(); | 
|  | 106     assertRefactoringStatusOK(status); | 
|  | 107   } | 
|  | 108 | 
| 93   test_checkFinalConditions_OK_noShadow() async { | 109   test_checkFinalConditions_OK_noShadow() async { | 
| 94     indexTestUnit(''' | 110     indexTestUnit(''' | 
| 95 class A { | 111 class A { | 
| 96   int newName; | 112   int newName; | 
| 97 } | 113 } | 
| 98 class B { | 114 class B { | 
| 99   test() {} | 115   test() {} | 
| 100 } | 116 } | 
| 101 class C extends A { | 117 class C extends A { | 
| 102   main() { | 118   main() { | 
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 856     // validate change | 872     // validate change | 
| 857     return assertSuccessfulRefactoring(''' | 873     return assertSuccessfulRefactoring(''' | 
| 858 class A<NewName> { | 874 class A<NewName> { | 
| 859   NewName field; | 875   NewName field; | 
| 860   List<NewName> items; | 876   List<NewName> items; | 
| 861   NewName method(NewName p) => null; | 877   NewName method(NewName p) => null; | 
| 862 } | 878 } | 
| 863 '''); | 879 '''); | 
| 864   } | 880   } | 
| 865 } | 881 } | 
| OLD | NEW | 
|---|