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

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

Issue 1385403007: Fix for renaming (an invalid) ClassElement invocation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/index/dart_index_contributor_test.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_unit_member; 5 library test.services.refactoring.rename_unit_member;
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_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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 factory Other.a() = NewName; 393 factory Other.a() = NewName;
394 factory Other.b() = NewName.named; 394 factory Other.b() = NewName.named;
395 } 395 }
396 main() { 396 main() {
397 NewName t1 = new NewName(); 397 NewName t1 = new NewName();
398 NewName t2 = new NewName.named(); 398 NewName t2 = new NewName.named();
399 } 399 }
400 '''); 400 ''');
401 } 401 }
402 402
403 test_createChange_ClassElement_invocation() {
404 verifyNoTestUnitErrors = false;
405 indexTestUnit('''
406 class Test {
407 }
408 main() {
409 Test(); // invalid code, but still a reference
410 }
411 ''');
412 // configure refactoring
413 createRenameRefactoringAtString('Test();');
414 expect(refactoring.refactoringName, 'Rename Class');
415 expect(refactoring.elementKindName, 'class');
416 expect(refactoring.oldName, 'Test');
417 refactoring.newName = 'NewName';
418 // validate change
419 return assertSuccessfulRefactoring('''
420 class NewName {
421 }
422 main() {
423 NewName(); // invalid code, but still a reference
424 }
425 ''');
426 }
427
403 test_createChange_ClassElement_parameterTypeNested() { 428 test_createChange_ClassElement_parameterTypeNested() {
404 indexTestUnit(''' 429 indexTestUnit('''
405 class Test { 430 class Test {
406 } 431 }
407 main(f(Test p)) { 432 main(f(Test p)) {
408 } 433 }
409 '''); 434 ''');
410 // configure refactoring 435 // configure refactoring
411 createRenameRefactoringAtString('Test {'); 436 createRenameRefactoringAtString('Test {');
412 expect(refactoring.refactoringName, 'Rename Class'); 437 expect(refactoring.refactoringName, 'Rename Class');
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 return assertSuccessfulRefactoring(''' 578 return assertSuccessfulRefactoring('''
554 int newName = 0; 579 int newName = 0;
555 main() { 580 main() {
556 print(newName); 581 print(newName);
557 newName = 1; 582 newName = 1;
558 newName += 2; 583 newName += 2;
559 } 584 }
560 '''); 585 ''');
561 } 586 }
562 } 587 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/services/index/dart_index_contributor_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698