| 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_local; | 5 library test.services.refactoring.inline_local; |
| 6 | 6 |
| 7 import 'package:analysis_server/plugin/protocol/protocol.dart' hide Element; | 7 import 'package:analysis_server/plugin/protocol/protocol.dart' hide Element; |
| 8 import 'package:analysis_server/src/services/correction/status.dart'; | 8 import 'package:analysis_server/src/services/correction/status.dart'; |
| 9 import 'package:analysis_server/src/services/refactoring/inline_local.dart'; | 9 import 'package:analysis_server/src/services/refactoring/inline_local.dart'; |
| 10 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; | 10 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 indexTestUnit(r""" | 310 indexTestUnit(r""" |
| 311 main() { | 311 main() { |
| 312 String a = ''' | 312 String a = ''' |
| 313 a | 313 a |
| 314 a | 314 a |
| 315 a'''; | 315 a'''; |
| 316 String b = ''' | 316 String b = ''' |
| 317 $a | 317 $a |
| 318 bbb'''; | 318 bbb'''; |
| 319 } | 319 } |
| 320 """.replaceAll('\n', '\r\n')); | 320 """ |
| 321 .replaceAll('\n', '\r\n')); |
| 321 _createRefactoring('a ='); | 322 _createRefactoring('a ='); |
| 322 // validate change | 323 // validate change |
| 323 return assertSuccessfulRefactoring(r""" | 324 return assertSuccessfulRefactoring(r""" |
| 324 main() { | 325 main() { |
| 325 String b = ''' | 326 String b = ''' |
| 326 a | 327 a |
| 327 a | 328 a |
| 328 a | 329 a |
| 329 bbb'''; | 330 bbb'''; |
| 330 } | 331 } |
| 331 """.replaceAll('\n', '\r\n')); | 332 """ |
| 333 .replaceAll('\n', '\r\n')); |
| 332 } | 334 } |
| 333 | 335 |
| 334 test_OK_intoStringInterpolation_string_multiLineIntoSingle() { | 336 test_OK_intoStringInterpolation_string_multiLineIntoSingle() { |
| 335 indexTestUnit(r''' | 337 indexTestUnit(r''' |
| 336 main() { | 338 main() { |
| 337 String a = """aaa"""; | 339 String a = """aaa"""; |
| 338 String b = "$a bbb"; | 340 String b = "$a bbb"; |
| 339 } | 341 } |
| 340 '''); | 342 '''); |
| 341 _createRefactoring('a ='); | 343 _createRefactoring('a ='); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL, | 631 assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL, |
| 630 expectedMessage: 'Local variable declaration or reference must be ' | 632 expectedMessage: 'Local variable declaration or reference must be ' |
| 631 'selected to activate this refactoring.'); | 633 'selected to activate this refactoring.'); |
| 632 } | 634 } |
| 633 | 635 |
| 634 void _createRefactoring(String search) { | 636 void _createRefactoring(String search) { |
| 635 int offset = findOffset(search); | 637 int offset = findOffset(search); |
| 636 refactoring = new InlineLocalRefactoring(searchEngine, testUnit, offset); | 638 refactoring = new InlineLocalRefactoring(searchEngine, testUnit, offset); |
| 637 } | 639 } |
| 638 } | 640 } |
| OLD | NEW |