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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 test_createChange() async { | 45 test_createChange() async { |
46 Source unitSource = addSource( | 46 Source unitSource = addSource( |
47 '/part.dart', | 47 '/part.dart', |
48 ''' | 48 ''' |
49 part of my.app; | 49 part of my.app; |
50 '''); | 50 '''); |
51 indexTestUnit(''' | 51 indexTestUnit(''' |
52 library my.app; | 52 library my.app; |
53 part 'part.dart'; | 53 part 'part.dart'; |
54 '''); | 54 '''); |
55 index.indexUnit( | 55 index.index( |
56 context, context.resolveCompilationUnit2(unitSource, testSource)); | 56 context, context.resolveCompilationUnit2(unitSource, testSource)); |
57 // configure refactoring | 57 // configure refactoring |
58 _createRenameRefactoring(); | 58 _createRenameRefactoring(); |
59 expect(refactoring.refactoringName, 'Rename Library'); | 59 expect(refactoring.refactoringName, 'Rename Library'); |
60 expect(refactoring.elementKindName, 'library'); | 60 expect(refactoring.elementKindName, 'library'); |
61 refactoring.newName = 'the.new.name'; | 61 refactoring.newName = 'the.new.name'; |
62 // validate change | 62 // validate change |
63 await assertSuccessfulRefactoring(''' | 63 await assertSuccessfulRefactoring(''' |
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 void _createRenameRefactoring() { | 74 void _createRenameRefactoring() { |
75 createRenameRefactoringForElement(testUnitElement.library); | 75 createRenameRefactoringForElement(testUnitElement.library); |
76 } | 76 } |
77 } | 77 } |
OLD | NEW |