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_constructor; | 5 library test.services.refactoring.rename_constructor; |
6 | 6 |
7 import 'package:analysis_server/src/protocol.dart'; | 7 import 'package:analysis_server/src/protocol.dart'; |
8 import 'package:analyzer/src/generated/ast.dart'; | 8 import 'package:analyzer/src/generated/ast.dart'; |
9 import 'package:analyzer/src/generated/element.dart'; | 9 import 'package:analyzer/src/generated/element.dart'; |
10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
11 | 11 |
12 import '../../reflective_tests.dart'; | 12 import '../../reflective_tests.dart'; |
13 import 'abstract_rename.dart'; | 13 import 'abstract_rename.dart'; |
14 | 14 |
15 | 15 |
16 main() { | 16 main() { |
17 groupSep = ' | '; | 17 groupSep = ' | '; |
18 runReflectiveTests(RenameConstructorTest); | 18 runReflectiveTests(RenameConstructorTest); |
19 } | 19 } |
20 | 20 |
21 | 21 |
22 @ReflectiveTestCase() | 22 @reflectiveTest |
23 class RenameConstructorTest extends RenameRefactoringTest { | 23 class RenameConstructorTest extends RenameRefactoringTest { |
24 test_checkFinalConditions_hasMember_constructor() { | 24 test_checkFinalConditions_hasMember_constructor() { |
25 indexTestUnit(''' | 25 indexTestUnit(''' |
26 class A { | 26 class A { |
27 A.test() {} | 27 A.test() {} |
28 A.newName() {} // existing | 28 A.newName() {} // existing |
29 } | 29 } |
30 '''); | 30 '''); |
31 _createConstructorDeclarationRefactoring('test() {}'); | 31 _createConstructorDeclarationRefactoring('test() {}'); |
32 // check status | 32 // check status |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 188 } |
189 '''); | 189 '''); |
190 } | 190 } |
191 | 191 |
192 void _createConstructorDeclarationRefactoring(String search) { | 192 void _createConstructorDeclarationRefactoring(String search) { |
193 ConstructorElement element = | 193 ConstructorElement element = |
194 findNodeElementAtString(search, (node) => node is ConstructorDeclaration
); | 194 findNodeElementAtString(search, (node) => node is ConstructorDeclaration
); |
195 createRenameRefactoringForElement(element); | 195 createRenameRefactoringForElement(element); |
196 } | 196 } |
197 } | 197 } |
OLD | NEW |