| 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.services.refactoring.inline_method; | 5 library test.services.refactoring.inline_method; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/protocol/protocol.dart' hide Element; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart' hide Element; |
| 10 import 'package:analysis_server/src/services/correction/status.dart'; | 10 import 'package:analysis_server/src/services/correction/status.dart'; |
| (...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1266 return _assertSuccessfulRefactoring(r''' | 1266 return _assertSuccessfulRefactoring(r''' |
| 1267 main() { | 1267 main() { |
| 1268 print((a, b) { | 1268 print((a, b) { |
| 1269 print(a); | 1269 print(a); |
| 1270 print(b); | 1270 print(b); |
| 1271 }); | 1271 }); |
| 1272 } | 1272 } |
| 1273 '''); | 1273 '''); |
| 1274 } | 1274 } |
| 1275 | 1275 |
| 1276 test_removeEmptyLinesBefore_method() { |
| 1277 indexTestUnit(r''' |
| 1278 class A { |
| 1279 before() { |
| 1280 } |
| 1281 |
| 1282 |
| 1283 test() { |
| 1284 print(0); |
| 1285 } |
| 1286 |
| 1287 foo() { |
| 1288 test(); |
| 1289 } |
| 1290 } |
| 1291 '''); |
| 1292 _createRefactoring('test() {'); |
| 1293 // validate change |
| 1294 return _assertSuccessfulRefactoring(r''' |
| 1295 class A { |
| 1296 before() { |
| 1297 } |
| 1298 |
| 1299 foo() { |
| 1300 print(0); |
| 1301 } |
| 1302 } |
| 1303 '''); |
| 1304 } |
| 1305 |
| 1276 test_setter_classMember_instance() { | 1306 test_setter_classMember_instance() { |
| 1277 indexTestUnit(r''' | 1307 indexTestUnit(r''' |
| 1278 class A { | 1308 class A { |
| 1279 int f; | 1309 int f; |
| 1280 void set result(x) { | 1310 void set result(x) { |
| 1281 f = x + 1; | 1311 f = x + 1; |
| 1282 } | 1312 } |
| 1283 } | 1313 } |
| 1284 main(A a) { | 1314 main(A a) { |
| 1285 a.result = 5; | 1315 a.result = 5; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1490 SourceChange change = await refactoring.createChange(); | 1520 SourceChange change = await refactoring.createChange(); |
| 1491 this.refactoringChange = change; | 1521 this.refactoringChange = change; |
| 1492 assertTestChangeResult(expectedCode); | 1522 assertTestChangeResult(expectedCode); |
| 1493 } | 1523 } |
| 1494 | 1524 |
| 1495 void _createRefactoring(String search) { | 1525 void _createRefactoring(String search) { |
| 1496 int offset = findOffset(search); | 1526 int offset = findOffset(search); |
| 1497 refactoring = new InlineMethodRefactoring(searchEngine, testUnit, offset); | 1527 refactoring = new InlineMethodRefactoring(searchEngine, testUnit, offset); |
| 1498 } | 1528 } |
| 1499 } | 1529 } |
| OLD | NEW |