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

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

Issue 1153253004: Issue 23389. Report error in the renamed element be invisible after rename. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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_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 '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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 } 59 }
60 '''); 60 ''');
61 createRenameRefactoringAtString('Test {}'); 61 createRenameRefactoringAtString('Test {}');
62 // check status 62 // check status
63 refactoring.newName = 'NewName'; 63 refactoring.newName = 'NewName';
64 RefactoringStatus status = await refactoring.checkFinalConditions(); 64 RefactoringStatus status = await refactoring.checkFinalConditions();
65 assertRefactoringStatusOK(status); 65 assertRefactoringStatusOK(status);
66 } 66 }
67 67
68 test_checkFinalConditions_publicToPrivate_usedInOtherLibrary() async {
69 indexTestUnit('''
70 class Test {}
71 ''');
72 indexUnit('/lib.dart', '''
73 library my.lib;
74 import 'test.dart';
75
76 main() {
77 new Test();
78 }
79 ''');
80 createRenameRefactoringAtString('Test {}');
81 // check status
82 refactoring.newName = '_NewName';
83 RefactoringStatus status = await refactoring.checkFinalConditions();
84 assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR,
85 expectedMessage: "Renamed class will be invisible in 'my.lib'.");
86 }
87
68 test_checkFinalConditions_shadowedBy_MethodElement() async { 88 test_checkFinalConditions_shadowedBy_MethodElement() async {
69 indexTestUnit(''' 89 indexTestUnit('''
70 class Test {} 90 class Test {}
71 class A { 91 class A {
72 void NewName() {} 92 void NewName() {}
73 main() { 93 main() {
74 new Test(); 94 new Test();
75 } 95 }
76 } 96 }
77 '''); 97 ''');
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 return assertSuccessfulRefactoring(''' 484 return assertSuccessfulRefactoring('''
465 int newName = 0; 485 int newName = 0;
466 main() { 486 main() {
467 print(newName); 487 print(newName);
468 newName = 1; 488 newName = 1;
469 newName += 2; 489 newName += 2;
470 } 490 }
471 '''); 491 ''');
472 } 492 }
473 } 493 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698