| 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/src/protocol.dart' hide Element; | 9 import 'package:analysis_server/src/protocol.dart' hide Element; |
| 10 import 'package:analysis_server/src/services/refactoring/inline_method.dart'; | 10 import 'package:analysis_server/src/services/refactoring/inline_method.dart'; |
| (...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 return _assertSuccessfulRefactoring(r''' | 992 return _assertSuccessfulRefactoring(r''' |
| 993 main() { | 993 main() { |
| 994 print((a, b) { | 994 print((a, b) { |
| 995 print(a); | 995 print(a); |
| 996 print(b); | 996 print(b); |
| 997 }); | 997 }); |
| 998 } | 998 } |
| 999 '''); | 999 '''); |
| 1000 } | 1000 } |
| 1001 | 1001 |
| 1002 test_reference_expressionBody() { |
| 1003 indexTestUnit(r''' |
| 1004 String message() => 'Hello, World!'; |
| 1005 main() { |
| 1006 print(message); |
| 1007 } |
| 1008 '''); |
| 1009 _createRefactoring('message()'); |
| 1010 // validate change |
| 1011 return _assertSuccessfulRefactoring(r''' |
| 1012 main() { |
| 1013 print(() => 'Hello, World!'); |
| 1014 } |
| 1015 '''); |
| 1016 } |
| 1017 |
| 1002 test_singleExpression_oneUsage() { | 1018 test_singleExpression_oneUsage() { |
| 1003 indexTestUnit(r''' | 1019 indexTestUnit(r''' |
| 1004 test(a, b) { | 1020 test(a, b) { |
| 1005 return a + b; | 1021 return a + b; |
| 1006 } | 1022 } |
| 1007 main() { | 1023 main() { |
| 1008 var res = test(1, 2); | 1024 var res = test(1, 2); |
| 1009 } | 1025 } |
| 1010 '''); | 1026 '''); |
| 1011 _createRefactoring('test(a, b)'); | 1027 _createRefactoring('test(a, b)'); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 }); | 1191 }); |
| 1176 }); | 1192 }); |
| 1177 }); | 1193 }); |
| 1178 } | 1194 } |
| 1179 | 1195 |
| 1180 void _createRefactoring(String search) { | 1196 void _createRefactoring(String search) { |
| 1181 int offset = findOffset(search); | 1197 int offset = findOffset(search); |
| 1182 refactoring = new InlineMethodRefactoring(searchEngine, testUnit, offset); | 1198 refactoring = new InlineMethodRefactoring(searchEngine, testUnit, offset); |
| 1183 } | 1199 } |
| 1184 } | 1200 } |
| OLD | NEW |