| 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_library; | 5 library test.services.refactoring.rename_library; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/protocol.dart'; | 7 import 'package:analysis_server/src/protocol.dart'; |
| 8 import 'package:analyzer/src/generated/source.dart'; | 8 import 'package:analyzer/src/generated/source.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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 library the.new.name; | 64 library the.new.name; |
| 65 part 'part.dart'; | 65 part 'part.dart'; |
| 66 '''); | 66 '''); |
| 67 assertFileChangeResult( | 67 assertFileChangeResult( |
| 68 '/part.dart', | 68 '/part.dart', |
| 69 ''' | 69 ''' |
| 70 part of the.new.name; | 70 part of the.new.name; |
| 71 '''); | 71 '''); |
| 72 } | 72 } |
| 73 | 73 |
| 74 test_createChange_hasWhitespaces() async { |
| 75 Source unitSource = addSource( |
| 76 '/part.dart', |
| 77 ''' |
| 78 part of my . app; |
| 79 '''); |
| 80 indexTestUnit(''' |
| 81 library my . app; |
| 82 part 'part.dart'; |
| 83 '''); |
| 84 index.index( |
| 85 context, context.resolveCompilationUnit2(unitSource, testSource)); |
| 86 // configure refactoring |
| 87 _createRenameRefactoring(); |
| 88 expect(refactoring.refactoringName, 'Rename Library'); |
| 89 expect(refactoring.elementKindName, 'library'); |
| 90 refactoring.newName = 'the.new.name'; |
| 91 // validate change |
| 92 await assertSuccessfulRefactoring(''' |
| 93 library the.new.name; |
| 94 part 'part.dart'; |
| 95 '''); |
| 96 assertFileChangeResult( |
| 97 '/part.dart', |
| 98 ''' |
| 99 part of the.new.name; |
| 100 '''); |
| 101 } |
| 102 |
| 74 void _createRenameRefactoring() { | 103 void _createRenameRefactoring() { |
| 75 createRenameRefactoringForElement(testUnitElement.library); | 104 createRenameRefactoringForElement(testUnitElement.library); |
| 76 } | 105 } |
| 77 } | 106 } |
| OLD | NEW |