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

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

Issue 1377623002: Report a fatal error on attempt to rename an element declared in SDK. (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
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_class_member; 5 library test.services.refactoring.rename_class_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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 createRenameRefactoringAtString('test() {}'); 234 createRenameRefactoringAtString('test() {}');
235 // check status 235 // check status
236 refactoring.newName = 'newName'; 236 refactoring.newName = 'newName';
237 RefactoringStatus status = await refactoring.checkFinalConditions(); 237 RefactoringStatus status = await refactoring.checkFinalConditions();
238 assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR, 238 assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR,
239 expectedMessage: 239 expectedMessage:
240 "Renamed method will be shadowed by method 'B.newName'.", 240 "Renamed method will be shadowed by method 'B.newName'.",
241 expectedContextSearch: 'newName() {} // marker'); 241 expectedContextSearch: 'newName() {} // marker');
242 } 242 }
243 243
244 test_checkInitialConditions_inSDK() async {
245 indexTestUnit('''
246 main() {
247 'abc'.toUpperCase();
248 }
249 ''');
250 createRenameRefactoringAtString('toUpperCase()');
251 // check status
252 refactoring.newName = 'NewName';
253 RefactoringStatus status = await refactoring.checkInitialConditions();
254 assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL,
255 expectedMessage:
256 "The method 'String.toUpperCase' is defined in the SDK, so cannot be renamed.");
257 }
258
244 test_checkInitialConditions_operator() async { 259 test_checkInitialConditions_operator() async {
245 indexTestUnit(''' 260 indexTestUnit('''
246 class A { 261 class A {
247 operator -(other) => this; 262 operator -(other) => this;
248 } 263 }
249 '''); 264 ''');
250 createRenameRefactoringAtString('-(other)'); 265 createRenameRefactoringAtString('-(other)');
251 // check status 266 // check status
252 refactoring.newName = 'newName'; 267 refactoring.newName = 'newName';
253 RefactoringStatus status = await refactoring.checkInitialConditions(); 268 RefactoringStatus status = await refactoring.checkInitialConditions();
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 // validate change 745 // validate change
731 return assertSuccessfulRefactoring(''' 746 return assertSuccessfulRefactoring('''
732 class A<NewName> { 747 class A<NewName> {
733 NewName field; 748 NewName field;
734 List<NewName> items; 749 List<NewName> items;
735 NewName method(NewName p) => null; 750 NewName method(NewName p) => null;
736 } 751 }
737 '''); 752 ''');
738 } 753 }
739 } 754 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698