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_import; | 5 library test.services.refactoring.rename_import; |
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:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
10 | 10 |
11 import '../../reflective_tests.dart'; | 11 import '../../reflective_tests.dart'; |
12 import 'abstract_rename.dart'; | 12 import 'abstract_rename.dart'; |
13 | 13 |
14 | 14 |
15 main() { | 15 main() { |
16 groupSep = ' | '; | 16 groupSep = ' | '; |
17 runReflectiveTests(RenameImportTest); | 17 runReflectiveTests(RenameImportTest); |
18 } | 18 } |
19 | 19 |
20 | 20 |
21 @ReflectiveTestCase() | 21 @reflectiveTest |
22 class RenameImportTest extends RenameRefactoringTest { | 22 class RenameImportTest extends RenameRefactoringTest { |
23 test_checkNewName() { | 23 test_checkNewName() { |
24 indexTestUnit("import 'dart:async' as test;"); | 24 indexTestUnit("import 'dart:async' as test;"); |
25 _createRefactoring("import 'dart:"); | 25 _createRefactoring("import 'dart:"); |
26 expect(refactoring.oldName, 'test'); | 26 expect(refactoring.oldName, 'test'); |
27 // null | 27 // null |
28 refactoring.newName = null; | 28 refactoring.newName = null; |
29 assertRefactoringStatus( | 29 assertRefactoringStatus( |
30 refactoring.checkNewName(), | 30 refactoring.checkNewName(), |
31 RefactoringProblemSeverity.FATAL, | 31 RefactoringProblemSeverity.FATAL, |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 expect(refactoring.refactoringName, 'Rename Import Prefix'); | 181 expect(refactoring.refactoringName, 'Rename Import Prefix'); |
182 expect(refactoring.oldName, ''); | 182 expect(refactoring.oldName, ''); |
183 } | 183 } |
184 | 184 |
185 void _createRefactoring(String search) { | 185 void _createRefactoring(String search) { |
186 ImportDirective directive = | 186 ImportDirective directive = |
187 findNodeAtString(search, (node) => node is ImportDirective); | 187 findNodeAtString(search, (node) => node is ImportDirective); |
188 createRenameRefactoringForElement(directive.element); | 188 createRenameRefactoringForElement(directive.element); |
189 } | 189 } |
190 } | 190 } |
OLD | NEW |