| 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_local; | 5 library test.services.refactoring.rename_local; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/protocol.dart'; | 7 import 'package:analysis_server/src/protocol.dart'; |
| 8 import '../../reflective_tests.dart'; | |
| 9 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 10 | 9 |
| 10 import '../../reflective_tests.dart'; |
| 11 import 'abstract_rename.dart'; | 11 import 'abstract_rename.dart'; |
| 12 | 12 |
| 13 | 13 |
| 14 main() { | 14 main() { |
| 15 groupSep = ' | '; | 15 groupSep = ' | '; |
| 16 runReflectiveTests(RenameLocalTest); | 16 runReflectiveTests(RenameLocalTest); |
| 17 } | 17 } |
| 18 | 18 |
| 19 | 19 |
| 20 @ReflectiveTestCase() | 20 @ReflectiveTestCase() |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 main2() { | 119 main2() { |
| 120 var newName = 1; | 120 var newName = 1; |
| 121 } | 121 } |
| 122 '''); | 122 '''); |
| 123 createRenameRefactoringAtString('test = 0'); | 123 createRenameRefactoringAtString('test = 0'); |
| 124 // check status | 124 // check status |
| 125 refactoring.newName = 'newName'; | 125 refactoring.newName = 'newName'; |
| 126 return assertRefactoringConditionsOK(); | 126 return assertRefactoringConditionsOK(); |
| 127 } | 127 } |
| 128 | 128 |
| 129 test_checkFinalConditions_shadows_OK_namedParameterReference() { |
| 130 indexTestUnit(''' |
| 131 void f({newName}) {} |
| 132 main() { |
| 133 var test = 0; |
| 134 f(newName: test); |
| 135 } |
| 136 '''); |
| 137 createRenameRefactoringAtString('test = 0'); |
| 138 // check status |
| 139 refactoring.newName = 'newName'; |
| 140 return assertRefactoringFinalConditionsOK(); |
| 141 } |
| 142 |
| 129 test_checkFinalConditions_shadows_classMember() { | 143 test_checkFinalConditions_shadows_classMember() { |
| 130 indexTestUnit(''' | 144 indexTestUnit(''' |
| 131 class A { | 145 class A { |
| 132 var newName = 1; | 146 var newName = 1; |
| 133 main() { | 147 main() { |
| 134 var test = 0; | 148 var test = 0; |
| 135 print(newName); | 149 print(newName); |
| 136 } | 150 } |
| 137 } | 151 } |
| 138 '''); | 152 '''); |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 main() { | 480 main() { |
| 467 int test = 0; | 481 int test = 0; |
| 468 } | 482 } |
| 469 '''); | 483 '''); |
| 470 // configure refactoring | 484 // configure refactoring |
| 471 createRenameRefactoringAtString('test = 0'); | 485 createRenameRefactoringAtString('test = 0'); |
| 472 // old name | 486 // old name |
| 473 expect(refactoring.oldName, 'test'); | 487 expect(refactoring.oldName, 'test'); |
| 474 } | 488 } |
| 475 } | 489 } |
| OLD | NEW |