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

Unified Diff: pkg/analysis_server/test/edit/refactoring_test.dart

Issue 921833002: Issue 22381. Fix for navigating to constructor from redirecting factory constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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
Index: pkg/analysis_server/test/edit/refactoring_test.dart
diff --git a/pkg/analysis_server/test/edit/refactoring_test.dart b/pkg/analysis_server/test/edit/refactoring_test.dart
index 51e1a4e88a99bd69e072009d8184c61033f30cfc..fbaf6ff49832eb3225f32064656ae5b35ce62877 100644
--- a/pkg/analysis_server/test/edit/refactoring_test.dart
+++ b/pkg/analysis_server/test/edit/refactoring_test.dart
@@ -1029,8 +1029,8 @@ import 'bin/lib.dart';
@reflectiveTest
class RenameTest extends _AbstractGetRefactoring_Test {
- Future<Response> sendRenameRequest(String search, String newName,
- {String id: '0', bool validateOnly: false}) {
+ Future<Response> sendRenameRequest(String search, String newName, {String id:
+ '0', bool validateOnly: false}) {
RenameOptions options = newName != null ? new RenameOptions(newName) : null;
Request request = new EditGetRefactoringParams(
RefactoringKind.RENAME,
@@ -1057,7 +1057,9 @@ main() {
Response responseA = await futureA;
// "1" was cancelled
// "2" is successful
- expect(responseA, isResponseFailure('1', RequestErrorCode.REFACTORING_REQUEST_CANCELLED));
+ expect(
+ responseA,
+ isResponseFailure('1', RequestErrorCode.REFACTORING_REQUEST_CANCELLED));
expect(responseB, isResponseSuccess('2'));
}
@@ -1326,6 +1328,27 @@ class A {
''');
}
+ test_constructor_fromFactoryRedirectingConstructor_onClassName() {
+ addTestFile('''
+class A {
+ A() = B;
+}
+class B {
+ B() {}
+}
+''');
+ return assertSuccessfulRefactoring(() {
+ return sendRenameRequest('B;', 'newName');
+ }, '''
+class A {
+ A() = B.newName;
+}
+class B {
+ B.newName() {}
+}
+''');
+ }
+
test_constructor_fromInstanceCreation() {
addTestFile('''
class A {
@@ -1576,7 +1599,10 @@ main() {
// send the second request, with the same kind, file and offset
return waitForTasksFinished().then((_) {
return getRefactoringResult(() {
- return sendRenameRequest('otherName =', 'newName', validateOnly: true);
+ return sendRenameRequest(
+ 'otherName =',
+ 'newName',
+ validateOnly: true);
}).then((result) {
RenameFeedback feedback = result.feedback;
// the refactoring was reset, so we don't get a stale result

Powered by Google App Engine
This is Rietveld 408576698