Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: pkg/analysis_server/test/services/refactoring/rename_library_test.dart

Issue 2614903006: Run 'Rename Library' refactoring tests with the new analysis driver. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/plugin/protocol/protocol.dart'; 7 import 'package:analysis_server/plugin/protocol/protocol.dart';
8 import 'package:analyzer/src/generated/source.dart'; 8 import 'package:analyzer/src/generated/source.dart';
9 import 'package:test/test.dart'; 9 import 'package:test/test.dart';
10 import 'package:test_reflective_loader/test_reflective_loader.dart'; 10 import 'package:test_reflective_loader/test_reflective_loader.dart';
11 11
12 import 'abstract_rename.dart'; 12 import 'abstract_rename.dart';
13 13
14 main() { 14 main() {
15 defineReflectiveSuite(() { 15 defineReflectiveSuite(() {
16 defineReflectiveTests(RenameLibraryTest); 16 defineReflectiveTests(RenameLibraryTest);
17 defineReflectiveTests(RenameLibraryTest_Driver);
17 }); 18 });
18 } 19 }
19 20
20 @reflectiveTest 21 @reflectiveTest
21 class RenameLibraryTest extends RenameRefactoringTest { 22 class RenameLibraryTest extends RenameRefactoringTest {
22 test_checkNewName() async { 23 test_checkNewName() async {
23 await indexTestUnit(''' 24 await indexTestUnit('''
24 library my.app; 25 library my.app;
25 '''); 26 ''');
26 _createRenameRefactoring(); 27 _createRenameRefactoring();
(...skipping 18 matching lines...) Expand all
45 test_createChange() async { 46 test_createChange() async {
46 Source unitSource = addSource( 47 Source unitSource = addSource(
47 '/part.dart', 48 '/part.dart',
48 ''' 49 '''
49 part of my.app; 50 part of my.app;
50 '''); 51 ''');
51 await indexTestUnit(''' 52 await indexTestUnit('''
52 library my.app; 53 library my.app;
53 part 'part.dart'; 54 part 'part.dart';
54 '''); 55 ''');
55 index.indexUnit(context.resolveCompilationUnit2(unitSource, testSource)); 56 if (!enableNewAnalysisDriver) {
57 index.indexUnit(context.resolveCompilationUnit2(unitSource, testSource));
58 }
56 // configure refactoring 59 // configure refactoring
57 _createRenameRefactoring(); 60 _createRenameRefactoring();
58 expect(refactoring.refactoringName, 'Rename Library'); 61 expect(refactoring.refactoringName, 'Rename Library');
59 expect(refactoring.elementKindName, 'library'); 62 expect(refactoring.elementKindName, 'library');
60 refactoring.newName = 'the.new.name'; 63 refactoring.newName = 'the.new.name';
61 // validate change 64 // validate change
62 await assertSuccessfulRefactoring(''' 65 await assertSuccessfulRefactoring('''
63 library the.new.name; 66 library the.new.name;
64 part 'part.dart'; 67 part 'part.dart';
65 '''); 68 ''');
66 assertFileChangeResult( 69 assertFileChangeResult(
67 '/part.dart', 70 '/part.dart',
68 ''' 71 '''
69 part of the.new.name; 72 part of the.new.name;
70 '''); 73 ''');
71 } 74 }
72 75
73 test_createChange_hasWhitespaces() async { 76 test_createChange_hasWhitespaces() async {
74 Source unitSource = addSource( 77 Source unitSource = addSource(
75 '/part.dart', 78 '/part.dart',
76 ''' 79 '''
77 part of my . app; 80 part of my . app;
78 '''); 81 ''');
79 await indexTestUnit(''' 82 await indexTestUnit('''
80 library my . app; 83 library my . app;
81 part 'part.dart'; 84 part 'part.dart';
82 '''); 85 ''');
83 index.indexUnit(context.resolveCompilationUnit2(unitSource, testSource)); 86 if (!enableNewAnalysisDriver) {
87 index.indexUnit(context.resolveCompilationUnit2(unitSource, testSource));
88 }
84 // configure refactoring 89 // configure refactoring
85 _createRenameRefactoring(); 90 _createRenameRefactoring();
86 expect(refactoring.refactoringName, 'Rename Library'); 91 expect(refactoring.refactoringName, 'Rename Library');
87 expect(refactoring.elementKindName, 'library'); 92 expect(refactoring.elementKindName, 'library');
88 refactoring.newName = 'the.new.name'; 93 refactoring.newName = 'the.new.name';
89 // validate change 94 // validate change
90 await assertSuccessfulRefactoring(''' 95 await assertSuccessfulRefactoring('''
91 library the.new.name; 96 library the.new.name;
92 part 'part.dart'; 97 part 'part.dart';
93 '''); 98 ''');
94 assertFileChangeResult( 99 assertFileChangeResult(
95 '/part.dart', 100 '/part.dart',
96 ''' 101 '''
97 part of the.new.name; 102 part of the.new.name;
98 '''); 103 ''');
99 } 104 }
100 105
101 void _createRenameRefactoring() { 106 void _createRenameRefactoring() {
102 createRenameRefactoringForElement(testUnitElement.library); 107 createRenameRefactoringForElement(testUnitElement.library);
103 } 108 }
104 } 109 }
110
111 @reflectiveTest
112 class RenameLibraryTest_Driver extends RenameLibraryTest {
113 @override
114 bool get enableNewAnalysisDriver => true;
115 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698