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

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

Issue 2289823002: Issue 27179. Materialize synthetic constructors on rename. (Closed)
Patch Set: Created 4 years, 4 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 bb4318b31a0e013a4ede00c117fb4bd1c4bdb2a2..f10a11dd518eba5fcd66746bc21fe9fcdafe873e 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart
@@ -132,6 +132,39 @@ main() {
''');
}
+ test_createChange_add_toSynthetic() {
+ indexTestUnit('''
+class A {
+}
+class B extends A {
+ B() : super() {}
+ factory B._() = A;
+}
+main() {
+ new A();
+}
+''');
+ // configure refactoring
+ _createConstructorInvocationRefactoring('new A();');
+ expect(refactoring.refactoringName, 'Rename Constructor');
+ expect(refactoring.elementKindName, 'constructor');
+ expect(refactoring.oldName, '');
+ // validate change
+ refactoring.newName = 'newName';
+ return assertSuccessfulRefactoring('''
+class A {
+ A.newName();
+}
+class B extends A {
+ B() : super.newName() {}
+ factory B._() = A.newName;
+}
+main() {
+ new A.newName();
+}
+''');
+ }
+
test_createChange_change() {
indexTestUnit('''
class A {
@@ -210,4 +243,10 @@ main() {
search, (node) => node is ConstructorDeclaration);
createRenameRefactoringForElement(element);
}
+
+ void _createConstructorInvocationRefactoring(String search) {
+ ConstructorElement element = findNodeElementAtString(
+ search, (node) => node is InstanceCreationExpression);
+ createRenameRefactoringForElement(element);
+ }
}
« 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