| OLD | NEW |
| 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 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 return sendRenameRequest('test() {}', 'newName'); | 1251 return sendRenameRequest('test() {}', 'newName'); |
| 1252 }, ''' | 1252 }, ''' |
| 1253 newName() {} | 1253 newName() {} |
| 1254 main() { | 1254 main() { |
| 1255 newName(); | 1255 newName(); |
| 1256 print(newName); | 1256 print(newName); |
| 1257 } | 1257 } |
| 1258 '''); | 1258 '''); |
| 1259 } | 1259 } |
| 1260 | 1260 |
| 1261 test_importPrefix_add() { |
| 1262 addTestFile(''' |
| 1263 import 'dart:math'; |
| 1264 import 'dart:async'; |
| 1265 main() { |
| 1266 Random r; |
| 1267 Future f; |
| 1268 } |
| 1269 '''); |
| 1270 return assertSuccessfulRefactoring(() { |
| 1271 return sendRenameRequest("import 'dart:async';", 'new_name'); |
| 1272 }, ''' |
| 1273 import 'dart:math'; |
| 1274 import 'dart:async' as new_name; |
| 1275 main() { |
| 1276 Random r; |
| 1277 new_name.Future f; |
| 1278 } |
| 1279 '''); |
| 1280 } |
| 1281 |
| 1282 test_importPrefix_remove() { |
| 1283 addTestFile(''' |
| 1284 import 'dart:math' as test; |
| 1285 import 'dart:async' as test; |
| 1286 main() { |
| 1287 test.Random r; |
| 1288 test.Future f; |
| 1289 } |
| 1290 '''); |
| 1291 return assertSuccessfulRefactoring(() { |
| 1292 return sendRenameRequest("import 'dart:async' as test;", ''); |
| 1293 }, ''' |
| 1294 import 'dart:math' as test; |
| 1295 import 'dart:async'; |
| 1296 main() { |
| 1297 test.Random r; |
| 1298 Future f; |
| 1299 } |
| 1300 '''); |
| 1301 } |
| 1302 |
| 1261 test_init_fatalError_noElement() { | 1303 test_init_fatalError_noElement() { |
| 1262 addTestFile('// nothing to rename'); | 1304 addTestFile('// nothing to rename'); |
| 1263 return getRefactoringResult(() { | 1305 return getRefactoringResult(() { |
| 1264 return sendRenameRequest('// nothing', null); | 1306 return sendRenameRequest('// nothing', null); |
| 1265 }).then((result) { | 1307 }).then((result) { |
| 1266 assertResultProblemsFatal( | 1308 assertResultProblemsFatal( |
| 1267 result.initialProblems, | 1309 result.initialProblems, |
| 1268 'Unable to create a refactoring'); | 1310 'Unable to create a refactoring'); |
| 1269 // ...there is no any change | 1311 // ...there is no any change |
| 1270 expect(result.change, isNull); | 1312 expect(result.change, isNull); |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1502 } | 1544 } |
| 1503 | 1545 |
| 1504 @override | 1546 @override |
| 1505 void setUp() { | 1547 void setUp() { |
| 1506 super.setUp(); | 1548 super.setUp(); |
| 1507 server.handlers = [new EditDomainHandler(server),]; | 1549 server.handlers = [new EditDomainHandler(server),]; |
| 1508 createProject(); | 1550 createProject(); |
| 1509 handler = new EditDomainHandler(server); | 1551 handler = new EditDomainHandler(server); |
| 1510 } | 1552 } |
| 1511 } | 1553 } |
| OLD | NEW |