| 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 '../../reflective_tests.dart'; | 8 import '../../reflective_tests.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 | 10 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 refactoring.newName = null; | 264 refactoring.newName = null; |
| 265 assertRefactoringStatus( | 265 assertRefactoringStatus( |
| 266 refactoring.checkNewName(), | 266 refactoring.checkNewName(), |
| 267 RefactoringProblemSeverity.FATAL, | 267 RefactoringProblemSeverity.FATAL, |
| 268 expectedMessage: "Field name must not be null."); | 268 expectedMessage: "Field name must not be null."); |
| 269 // OK | 269 // OK |
| 270 refactoring.newName = 'newName'; | 270 refactoring.newName = 'newName'; |
| 271 assertRefactoringStatusOK(refactoring.checkNewName()); | 271 assertRefactoringStatusOK(refactoring.checkNewName()); |
| 272 } | 272 } |
| 273 | 273 |
| 274 test_checkNewName_FieldElement_const() { | |
| 275 indexTestUnit(''' | |
| 276 class A { | |
| 277 static const int TEST = 0; | |
| 278 } | |
| 279 '''); | |
| 280 createRenameRefactoringAtString('TEST ='); | |
| 281 // null | |
| 282 refactoring.newName = null; | |
| 283 assertRefactoringStatus( | |
| 284 refactoring.checkNewName(), | |
| 285 RefactoringProblemSeverity.FATAL, | |
| 286 expectedMessage: "Constant name must not be null."); | |
| 287 // not upper case | |
| 288 refactoring.newName = 'newName'; | |
| 289 assertRefactoringStatus( | |
| 290 refactoring.checkNewName(), | |
| 291 RefactoringProblemSeverity.WARNING); | |
| 292 // OK | |
| 293 refactoring.newName = 'NEW_NAME'; | |
| 294 assertRefactoringStatusOK(refactoring.checkNewName()); | |
| 295 } | |
| 296 | |
| 297 test_checkNewName_MethodElement() { | 274 test_checkNewName_MethodElement() { |
| 298 indexTestUnit(''' | 275 indexTestUnit(''' |
| 299 class A { | 276 class A { |
| 300 test() {} | 277 test() {} |
| 301 } | 278 } |
| 302 '''); | 279 '''); |
| 303 createRenameRefactoringAtString('test() {}'); | 280 createRenameRefactoringAtString('test() {}'); |
| 304 // null | 281 // null |
| 305 refactoring.newName = null; | 282 refactoring.newName = null; |
| 306 assertRefactoringStatus( | 283 assertRefactoringStatus( |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 // validate change | 705 // validate change |
| 729 return assertSuccessfulRefactoring(''' | 706 return assertSuccessfulRefactoring(''' |
| 730 class A<NewName> { | 707 class A<NewName> { |
| 731 NewName field; | 708 NewName field; |
| 732 List<NewName> items; | 709 List<NewName> items; |
| 733 NewName method(NewName p) => null; | 710 NewName method(NewName p) => null; |
| 734 } | 711 } |
| 735 '''); | 712 '''); |
| 736 } | 713 } |
| 737 } | 714 } |
| OLD | NEW |