| 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.extract_local; | 5 library test.services.refactoring.extract_local; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart'; | 9 import 'package:analysis_server/src/protocol.dart'; |
| 10 import 'package:analysis_server/src/services/correction/status.dart'; | 10 import 'package:analysis_server/src/services/correction/status.dart'; |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 int get foo => 42; | 699 int get foo => 42; |
| 700 } | 700 } |
| 701 main() { | 701 main() { |
| 702 A a = new A(); | 702 A a = new A(); |
| 703 var res = a.foo; | 703 var res = a.foo; |
| 704 int b = 1 + res; // marker | 704 int b = 1 + res; // marker |
| 705 } | 705 } |
| 706 '''); | 706 '''); |
| 707 } | 707 } |
| 708 | 708 |
| 709 test_singleExpression_hasParseError_expectedSemicolon() { |
| 710 verifyNoTestUnitErrors = false; |
| 711 indexTestUnit(''' |
| 712 main(p) { |
| 713 foo |
| 714 p.bar.baz; |
| 715 } |
| 716 '''); |
| 717 _createRefactoringForString('p.bar'); |
| 718 // apply refactoring |
| 719 return _assertSuccessfulRefactoring(''' |
| 720 main(p) { |
| 721 foo |
| 722 var res = p.bar; |
| 723 res.baz; |
| 724 } |
| 725 '''); |
| 726 } |
| 727 |
| 709 test_singleExpression_inExpressionBody() { | 728 test_singleExpression_inExpressionBody() { |
| 710 indexTestUnit(''' | 729 indexTestUnit(''' |
| 711 main() { | 730 main() { |
| 712 print((x) => x.y * x.y + 1); | 731 print((x) => x.y * x.y + 1); |
| 713 } | 732 } |
| 714 '''); | 733 '''); |
| 715 _createRefactoringForString('x.y'); | 734 _createRefactoringForString('x.y'); |
| 716 // apply refactoring | 735 // apply refactoring |
| 717 return _assertSuccessfulRefactoring(''' | 736 return _assertSuccessfulRefactoring(''' |
| 718 main() { | 737 main() { |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 int length = search.length; | 961 int length = search.length; |
| 943 _createRefactoring(offset, length); | 962 _createRefactoring(offset, length); |
| 944 } | 963 } |
| 945 | 964 |
| 946 void _createRefactoringWithSuffix(String selectionSearch, String suffix) { | 965 void _createRefactoringWithSuffix(String selectionSearch, String suffix) { |
| 947 int offset = findOffset(selectionSearch + suffix); | 966 int offset = findOffset(selectionSearch + suffix); |
| 948 int length = selectionSearch.length; | 967 int length = selectionSearch.length; |
| 949 _createRefactoring(offset, length); | 968 _createRefactoring(offset, length); |
| 950 } | 969 } |
| 951 } | 970 } |
| OLD | NEW |