| 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 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 return sendRenameRequest('// nothing', null); | 1264 return sendRenameRequest('// nothing', null); |
| 1265 }).then((result) { | 1265 }).then((result) { |
| 1266 assertResultProblemsFatal( | 1266 assertResultProblemsFatal( |
| 1267 result.initialProblems, | 1267 result.initialProblems, |
| 1268 'Unable to create a refactoring'); | 1268 'Unable to create a refactoring'); |
| 1269 // ...there is no any change | 1269 // ...there is no any change |
| 1270 expect(result.change, isNull); | 1270 expect(result.change, isNull); |
| 1271 }); | 1271 }); |
| 1272 } | 1272 } |
| 1273 | 1273 |
| 1274 test_library_libraryDirective() { |
| 1275 addTestFile(''' |
| 1276 library aaa.bbb.ccc; |
| 1277 '''); |
| 1278 return assertSuccessfulRefactoring(() { |
| 1279 return sendRenameRequest('library aaa', 'my.new_name'); |
| 1280 }, ''' |
| 1281 library my.new_name; |
| 1282 '''); |
| 1283 } |
| 1284 |
| 1285 test_library_libraryDirective_name() { |
| 1286 addTestFile(''' |
| 1287 library aaa.bbb.ccc; |
| 1288 '''); |
| 1289 return assertSuccessfulRefactoring(() { |
| 1290 return sendRenameRequest('aaa', 'my.new_name'); |
| 1291 }, ''' |
| 1292 library my.new_name; |
| 1293 '''); |
| 1294 } |
| 1295 |
| 1296 test_library_libraryDirective_nameDot() { |
| 1297 addTestFile(''' |
| 1298 library aaa.bbb.ccc; |
| 1299 '''); |
| 1300 return assertSuccessfulRefactoring(() { |
| 1301 return sendRenameRequest('.bbb', 'my.new_name'); |
| 1302 }, ''' |
| 1303 library my.new_name; |
| 1304 '''); |
| 1305 } |
| 1306 |
| 1274 test_localVariable() { | 1307 test_localVariable() { |
| 1275 addTestFile(''' | 1308 addTestFile(''' |
| 1276 main() { | 1309 main() { |
| 1277 int test = 0; | 1310 int test = 0; |
| 1278 test = 1; | 1311 test = 1; |
| 1279 test += 2; | 1312 test += 2; |
| 1280 print(test); | 1313 print(test); |
| 1281 } | 1314 } |
| 1282 '''); | 1315 '''); |
| 1283 return assertSuccessfulRefactoring(() { | 1316 return assertSuccessfulRefactoring(() { |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1469 } | 1502 } |
| 1470 | 1503 |
| 1471 @override | 1504 @override |
| 1472 void setUp() { | 1505 void setUp() { |
| 1473 super.setUp(); | 1506 super.setUp(); |
| 1474 server.handlers = [new EditDomainHandler(server),]; | 1507 server.handlers = [new EditDomainHandler(server),]; |
| 1475 createProject(); | 1508 createProject(); |
| 1476 handler = new EditDomainHandler(server); | 1509 handler = new EditDomainHandler(server); |
| 1477 } | 1510 } |
| 1478 } | 1511 } |
| OLD | NEW |