| 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.correction.assist; | 5 library test.services.correction.assist; |
| 6 | 6 |
| 7 import 'package:analysis_server/plugin/edit/assist/assist_core.dart'; | 7 import 'package:analysis_server/plugin/edit/assist/assist_core.dart'; |
| 8 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 8 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 9 import 'package:analysis_server/src/plugin/server_plugin.dart'; | 9 import 'package:analysis_server/src/plugin/server_plugin.dart'; |
| 10 import 'package:analysis_server/src/services/correction/assist.dart'; | 10 import 'package:analysis_server/src/services/correction/assist.dart'; |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 void test_assignToLocalVariable_alreadyAssignment() { | 787 void test_assignToLocalVariable_alreadyAssignment() { |
| 788 resolveTestUnit(''' | 788 resolveTestUnit(''' |
| 789 main() { | 789 main() { |
| 790 var vvv; | 790 var vvv; |
| 791 vvv = 42; | 791 vvv = 42; |
| 792 } | 792 } |
| 793 '''); | 793 '''); |
| 794 assertNoAssistAt('vvv =', DartAssistKind.ASSIGN_TO_LOCAL_VARIABLE); | 794 assertNoAssistAt('vvv =', DartAssistKind.ASSIGN_TO_LOCAL_VARIABLE); |
| 795 } | 795 } |
| 796 | 796 |
| 797 void test_assignToLocalVariable_inClosure() { |
| 798 resolveTestUnit(r''' |
| 799 main() { |
| 800 print(() { |
| 801 12345; |
| 802 }); |
| 803 } |
| 804 '''); |
| 805 assertHasAssistAt( |
| 806 '345', |
| 807 DartAssistKind.ASSIGN_TO_LOCAL_VARIABLE, |
| 808 ''' |
| 809 main() { |
| 810 print(() { |
| 811 var i = 12345; |
| 812 }); |
| 813 } |
| 814 '''); |
| 815 } |
| 816 |
| 797 void test_assignToLocalVariable_invocationArgument() { | 817 void test_assignToLocalVariable_invocationArgument() { |
| 798 resolveTestUnit(r''' | 818 resolveTestUnit(r''' |
| 799 main() { | 819 main() { |
| 800 f(12345); | 820 f(12345); |
| 801 } | 821 } |
| 802 int f(p) {} | 822 int f(p) {} |
| 803 '''); | 823 '''); |
| 804 assertNoAssistAt('345', DartAssistKind.ASSIGN_TO_LOCAL_VARIABLE); | 824 assertNoAssistAt('345', DartAssistKind.ASSIGN_TO_LOCAL_VARIABLE); |
| 805 } | 825 } |
| 806 | 826 |
| (...skipping 2870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3677 positions.add(new Position(testFile, offset)); | 3697 positions.add(new Position(testFile, offset)); |
| 3678 } | 3698 } |
| 3679 return positions; | 3699 return positions; |
| 3680 } | 3700 } |
| 3681 | 3701 |
| 3682 void _setStartEndSelection() { | 3702 void _setStartEndSelection() { |
| 3683 offset = findOffset('// start\n') + '// start\n'.length; | 3703 offset = findOffset('// start\n') + '// start\n'.length; |
| 3684 length = findOffset('// end') - offset; | 3704 length = findOffset('// end') - offset; |
| 3685 } | 3705 } |
| 3686 } | 3706 } |
| OLD | NEW |