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

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

Issue 545943003: Include additional information into RenameFeedback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
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/src/protocol.dart'; 7 import 'package:analysis_server/src/protocol.dart';
8 import '../../reflective_tests.dart'; 8 import '../../reflective_tests.dart';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 10
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 factory Other.b() = Test.named; 336 factory Other.b() = Test.named;
337 } 337 }
338 main() { 338 main() {
339 Test t1 = new Test(); 339 Test t1 = new Test();
340 Test t2 = new Test.named(); 340 Test t2 = new Test.named();
341 } 341 }
342 '''); 342 ''');
343 // configure refactoring 343 // configure refactoring
344 createRenameRefactoringAtString('Test implements'); 344 createRenameRefactoringAtString('Test implements');
345 expect(refactoring.refactoringName, 'Rename Class'); 345 expect(refactoring.refactoringName, 'Rename Class');
346 expect(refactoring.elementKindName, 'class');
346 expect(refactoring.oldName, 'Test'); 347 expect(refactoring.oldName, 'Test');
347 refactoring.newName = 'NewName'; 348 refactoring.newName = 'NewName';
348 // validate change 349 // validate change
349 return assertSuccessfulRefactoring(''' 350 return assertSuccessfulRefactoring('''
350 class NewName implements Other { 351 class NewName implements Other {
351 NewName() {} 352 NewName() {}
352 NewName.named() {} 353 NewName.named() {}
353 } 354 }
354 class Other { 355 class Other {
355 factory Other.a() = NewName; 356 factory Other.a() = NewName;
(...skipping 30 matching lines...) Expand all
386 test_createChange_ClassElement_typeAlias() { 387 test_createChange_ClassElement_typeAlias() {
387 indexTestUnit(''' 388 indexTestUnit('''
388 class A {} 389 class A {}
389 class Test = Object with A; 390 class Test = Object with A;
390 main(Test t) { 391 main(Test t) {
391 } 392 }
392 '''); 393 ''');
393 // configure refactoring 394 // configure refactoring
394 createRenameRefactoringAtString('Test ='); 395 createRenameRefactoringAtString('Test =');
395 expect(refactoring.refactoringName, 'Rename Class'); 396 expect(refactoring.refactoringName, 'Rename Class');
397 expect(refactoring.elementKindName, 'class');
396 expect(refactoring.oldName, 'Test'); 398 expect(refactoring.oldName, 'Test');
397 refactoring.newName = 'NewName'; 399 refactoring.newName = 'NewName';
398 // validate change 400 // validate change
399 return assertSuccessfulRefactoring(''' 401 return assertSuccessfulRefactoring('''
400 class A {} 402 class A {}
401 class NewName = Object with A; 403 class NewName = Object with A;
402 main(NewName t) { 404 main(NewName t) {
403 } 405 }
404 '''); 406 ''');
405 } 407 }
406 408
407 test_createChange_FunctionElement() { 409 test_createChange_FunctionElement() {
408 indexTestUnit(''' 410 indexTestUnit('''
409 test() {} 411 test() {}
410 foo() {} 412 foo() {}
411 main() { 413 main() {
412 print(test); 414 print(test);
413 print(test()); 415 print(test());
414 foo(); 416 foo();
415 } 417 }
416 '''); 418 ''');
417 // configure refactoring 419 // configure refactoring
418 createRenameRefactoringAtString('test() {}'); 420 createRenameRefactoringAtString('test() {}');
419 expect(refactoring.refactoringName, 'Rename Top-Level Function'); 421 expect(refactoring.refactoringName, 'Rename Top-Level Function');
422 expect(refactoring.elementKindName, 'function');
420 expect(refactoring.oldName, 'test'); 423 expect(refactoring.oldName, 'test');
421 refactoring.newName = 'newName'; 424 refactoring.newName = 'newName';
422 // validate change 425 // validate change
423 return assertSuccessfulRefactoring(''' 426 return assertSuccessfulRefactoring('''
424 newName() {} 427 newName() {}
425 foo() {} 428 foo() {}
426 main() { 429 main() {
427 print(newName); 430 print(newName);
428 print(newName()); 431 print(newName());
429 foo(); 432 foo();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 int test = 0; 502 int test = 0;
500 main() { 503 main() {
501 print(test); 504 print(test);
502 test = 1; 505 test = 1;
503 test += 2; 506 test += 2;
504 } 507 }
505 '''); 508 ''');
506 // configure refactoring 509 // configure refactoring
507 createRenameRefactoringAtString(search); 510 createRenameRefactoringAtString(search);
508 expect(refactoring.refactoringName, 'Rename Top-Level Variable'); 511 expect(refactoring.refactoringName, 'Rename Top-Level Variable');
512 expect(refactoring.elementKindName, 'top level variable');
509 expect(refactoring.oldName, 'test'); 513 expect(refactoring.oldName, 'test');
510 refactoring.newName = 'newName'; 514 refactoring.newName = 'newName';
511 // validate change 515 // validate change
512 return assertSuccessfulRefactoring(''' 516 return assertSuccessfulRefactoring('''
513 int newName = 0; 517 int newName = 0;
514 main() { 518 main() {
515 print(newName); 519 print(newName);
516 newName = 1; 520 newName = 1;
517 newName += 2; 521 newName += 2;
518 } 522 }
519 '''); 523 ''');
520 } 524 }
521 } 525 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/services/refactoring/rename_local_test.dart ('k') | pkg/analysis_server/tool/spec/spec_input.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698