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

Side by Side Diff: pkg/analysis_server/test/edit/refactoring_test.dart

Issue 749173002: Issue 21613. Fix for renaming FieldFormalParameterElement. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Additional tests. Created 6 years 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 | Annotate | Revision Log
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.edit.refactoring; 5 library test.edit.refactoring;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/edit/edit_domain.dart'; 9 import 'package:analysis_server/src/edit/edit_domain.dart';
10 import 'package:analysis_server/src/protocol.dart'; 10 import 'package:analysis_server/src/protocol.dart';
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 } 1064 }
1065 '''); 1065 ''');
1066 }); 1066 });
1067 }); 1067 });
1068 } 1068 }
1069 1069
1070 test_classMember_field() { 1070 test_classMember_field() {
1071 addTestFile(''' 1071 addTestFile('''
1072 class A { 1072 class A {
1073 var test = 0; 1073 var test = 0;
1074 A(this.test);
1074 main() { 1075 main() {
1075 print(test); 1076 print(test);
1076 } 1077 }
1077 } 1078 }
1078 '''); 1079 ''');
1079 return assertSuccessfulRefactoring(() { 1080 return assertSuccessfulRefactoring(() {
1080 return sendRenameRequest('test = 0', 'newName'); 1081 return sendRenameRequest('test = 0', 'newName');
1081 }, ''' 1082 }, '''
1082 class A { 1083 class A {
1083 var newName = 0; 1084 var newName = 0;
1085 A(this.newName);
1084 main() { 1086 main() {
1085 print(newName); 1087 print(newName);
1086 } 1088 }
1087 } 1089 }
1088 '''); 1090 ''');
1089 } 1091 }
1090 1092
1093 test_classMember_field_onFieldFormalParameter() {
1094 addTestFile('''
1095 class A {
1096 var test = 0;
1097 A(this.test);
1098 main() {
1099 print(test);
1100 }
1101 }
1102 ''');
1103 return assertSuccessfulRefactoring(() {
1104 return sendRenameRequest('test);', 'newName');
1105 }, '''
1106 class A {
1107 var newName = 0;
1108 A(this.newName);
1109 main() {
1110 print(newName);
1111 }
1112 }
1113 ''');
1114 }
1115
1116 test_classMember_field_onFieldFormalParameter_named() {
1117 addTestFile('''
1118 class A {
1119 final int test;
1120 A({this.test: 0});
1121 }
1122 main() {
1123 new A(test: 42);
1124 }
1125 ''');
1126 return assertSuccessfulRefactoring(() {
1127 return sendRenameRequest('test: 42', 'newName');
1128 }, '''
1129 class A {
1130 final int newName;
1131 A({this.newName: 0});
1132 }
1133 main() {
1134 new A(newName: 42);
1135 }
1136 ''');
1137 }
1138
1091 test_classMember_getter() { 1139 test_classMember_getter() {
1092 addTestFile(''' 1140 addTestFile('''
1093 class A { 1141 class A {
1094 get test => 0; 1142 get test => 0;
1095 main() { 1143 main() {
1096 print(test); 1144 print(test);
1097 } 1145 }
1098 } 1146 }
1099 '''); 1147 ''');
1100 return assertSuccessfulRefactoring(() { 1148 return assertSuccessfulRefactoring(() {
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 } 1617 }
1570 1618
1571 @override 1619 @override
1572 void setUp() { 1620 void setUp() {
1573 super.setUp(); 1621 super.setUp();
1574 server.handlers = [new EditDomainHandler(server),]; 1622 server.handlers = [new EditDomainHandler(server),];
1575 createProject(); 1623 createProject();
1576 handler = new EditDomainHandler(server); 1624 handler = new EditDomainHandler(server);
1577 } 1625 }
1578 } 1626 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698