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

Unified Diff: pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart

Issue 2399533003: Issue 27475. Discourage users from naming constructors the same as the enclosing classes. (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/services/refactoring/rename_constructor.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart
diff --git a/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart b/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart
index f10a11dd518eba5fcd66746bc21fe9fcdafe873e..6213f6f11bfc14c729ff832b5262871db2a9e5d8 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart
@@ -22,40 +22,6 @@ main() {
@reflectiveTest
class RenameConstructorTest extends RenameRefactoringTest {
- test_checkFinalConditions_hasMember_constructor() async {
- indexTestUnit('''
-class A {
- A.test() {}
- A.newName() {} // existing
-}
-''');
- _createConstructorDeclarationRefactoring('test() {}');
- // check status
- refactoring.newName = 'newName';
- RefactoringStatus status = await refactoring.checkFinalConditions();
- assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR,
- expectedMessage:
- "Class 'A' already declares constructor with name 'newName'.",
- expectedContextSearch: 'newName() {} // existing');
- }
-
- test_checkFinalConditions_hasMember_method() async {
- indexTestUnit('''
-class A {
- A.test() {}
- newName() {} // existing
-}
-''');
- _createConstructorDeclarationRefactoring('test() {}');
- // check status
- refactoring.newName = 'newName';
- RefactoringStatus status = await refactoring.checkFinalConditions();
- assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR,
- expectedMessage:
- "Class 'A' already declares method with name 'newName'.",
- expectedContextSearch: 'newName() {} // existing');
- }
-
test_checkInitialConditions_inSDK() async {
indexTestUnit('''
main() {
@@ -98,6 +64,40 @@ class A {
assertRefactoringStatusOK(refactoring.checkNewName());
}
+ test_checkNewName_hasMember_constructor() async {
+ indexTestUnit('''
+class A {
+ A.test() {}
+ A.newName() {} // existing
+}
+''');
+ _createConstructorDeclarationRefactoring('test() {}');
+ // check status
+ refactoring.newName = 'newName';
+ RefactoringStatus status = refactoring.checkNewName();
+ assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR,
+ expectedMessage:
+ "Class 'A' already declares constructor with name 'newName'.",
+ expectedContextSearch: 'newName() {} // existing');
+ }
+
+ test_checkNewName_hasMember_method() async {
+ indexTestUnit('''
+class A {
+ A.test() {}
+ newName() {} // existing
+}
+''');
+ _createConstructorDeclarationRefactoring('test() {}');
+ // check status
+ refactoring.newName = 'newName';
+ RefactoringStatus status = refactoring.checkNewName();
+ assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR,
+ expectedMessage:
+ "Class 'A' already declares method with name 'newName'.",
+ expectedContextSearch: 'newName() {} // existing');
+ }
+
test_createChange_add() {
indexTestUnit('''
class A {
« no previous file with comments | « pkg/analysis_server/lib/src/services/refactoring/rename_constructor.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698