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

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

Issue 2618993003: Run 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
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_local; 5 library test.services.refactoring.rename_local;
6 6
7 import 'package:analysis_server/plugin/protocol/protocol.dart'; 7 import 'package:analysis_server/plugin/protocol/protocol.dart';
8 import 'package:analysis_server/src/services/correction/status.dart'; 8 import 'package:analysis_server/src/services/correction/status.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(RenameLocalTest); 16 defineReflectiveTests(RenameLocalTest);
17 defineReflectiveTests(RenameLocalTest_Driver);
17 }); 18 });
18 } 19 }
19 20
20 @reflectiveTest 21 @reflectiveTest
21 class RenameLocalTest extends RenameRefactoringTest { 22 class RenameLocalTest extends RenameRefactoringTest {
22 test_checkFinalConditions_hasLocalFunction_after() async { 23 test_checkFinalConditions_hasLocalFunction_after() async {
23 await indexTestUnit(''' 24 await indexTestUnit('''
24 main() { 25 main() {
25 int test = 0; 26 int test = 0;
26 newName() => 1; 27 newName() => 1;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 RefactoringStatus status = await refactoring.checkFinalConditions(); 159 RefactoringStatus status = await refactoring.checkFinalConditions();
159 assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR, 160 assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR,
160 expectedMessage: 'Usage of field "A.newName" declared in "test.dart" ' 161 expectedMessage: 'Usage of field "A.newName" declared in "test.dart" '
161 'will be shadowed by renamed local variable.', 162 'will be shadowed by renamed local variable.',
162 expectedContextSearch: 'newName);'); 163 expectedContextSearch: 'newName);');
163 } 164 }
164 165
165 test_checkFinalConditions_shadows_classMember_namedParameter() async { 166 test_checkFinalConditions_shadows_classMember_namedParameter() async {
166 await indexTestUnit(''' 167 await indexTestUnit('''
167 class A { 168 class A {
168 foo({test: 1}) { 169 foo({test: 1}) { // in A
169 } 170 }
170 } 171 }
171 class B extends A { 172 class B extends A {
172 var newName = 1; 173 var newName = 1;
173 foo({test: 2}) { 174 foo({test: 1}) {
174 print(newName); 175 print(newName);
175 } 176 }
176 } 177 }
177 '''); 178 ''');
178 createRenameRefactoringAtString('test: 1}'); 179 createRenameRefactoringAtString('test: 1}) { // in A');
179 // check status 180 // check status
180 refactoring.newName = 'newName'; 181 refactoring.newName = 'newName';
181 RefactoringStatus status = await refactoring.checkFinalConditions(); 182 RefactoringStatus status = await refactoring.checkFinalConditions();
182 assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR, 183 assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR,
183 expectedMessage: 'Usage of field "B.newName" declared in "test.dart" ' 184 expectedMessage: 'Usage of field "B.newName" declared in "test.dart" '
184 'will be shadowed by renamed parameter.', 185 'will be shadowed by renamed parameter.',
185 expectedContextSearch: 'newName);'); 186 expectedContextSearch: 'newName);');
186 } 187 }
187 188
188 test_checkFinalConditions_shadows_classMemberOK_qualifiedReference() async { 189 test_checkFinalConditions_shadows_classMemberOK_qualifiedReference() async {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // check status 228 // check status
228 refactoring.newName = 'newName'; 229 refactoring.newName = 'newName';
229 RefactoringStatus status = await refactoring.checkFinalConditions(); 230 RefactoringStatus status = await refactoring.checkFinalConditions();
230 assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR, 231 assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR,
231 expectedContextSearch: 'newName(); // ref'); 232 expectedContextSearch: 'newName(); // ref');
232 } 233 }
233 234
234 test_checkNewName_FunctionElement() async { 235 test_checkNewName_FunctionElement() async {
235 await indexTestUnit(''' 236 await indexTestUnit('''
236 main() { 237 main() {
237 int test() {} 238 int test() => 0;
238 } 239 }
239 '''); 240 ''');
240 createRenameRefactoringAtString('test() {}'); 241 createRenameRefactoringAtString('test() => 0;');
241 // null 242 // null
242 refactoring.newName = null; 243 refactoring.newName = null;
243 assertRefactoringStatus( 244 assertRefactoringStatus(
244 refactoring.checkNewName(), RefactoringProblemSeverity.FATAL, 245 refactoring.checkNewName(), RefactoringProblemSeverity.FATAL,
245 expectedMessage: "Function name must not be null."); 246 expectedMessage: "Function name must not be null.");
246 // OK 247 // OK
247 refactoring.newName = 'newName'; 248 refactoring.newName = 'newName';
248 assertRefactoringStatusOK(refactoring.checkNewName()); 249 assertRefactoringStatusOK(refactoring.checkNewName());
249 } 250 }
250 251
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 main() { 547 main() {
547 int test = 0; 548 int test = 0;
548 } 549 }
549 '''); 550 ''');
550 // configure refactoring 551 // configure refactoring
551 createRenameRefactoringAtString('test = 0'); 552 createRenameRefactoringAtString('test = 0');
552 // old name 553 // old name
553 expect(refactoring.oldName, 'test'); 554 expect(refactoring.oldName, 'test');
554 } 555 }
555 } 556 }
557
558 @reflectiveTest
559 class RenameLocalTest_Driver extends RenameLocalTest {
560 @override
561 bool get enableNewAnalysisDriver => true;
562
563 @failingTest
564 @override
565 test_createChange_parameter_named_inOtherFile() {
566 return test_createChange_parameter_named_inOtherFile();
567 }
568
569 @failingTest
570 @override
571 test_createChange_parameter_named_updateHierarchy() {
572 return test_createChange_parameter_named_updateHierarchy();
573 }
574 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698