Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: pkg/analysis_server/test/services/correction/assist_test.dart

Issue 1473513003: Disable merging of 'if' statements when there are other staments in the outer one. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/assist_internal.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/plugin/edit/assist/assist_core.dart'; 9 import 'package:analysis_server/plugin/edit/assist/assist_core.dart';
10 import 'package:analysis_server/plugin/protocol/protocol.dart'; 10 import 'package:analysis_server/plugin/protocol/protocol.dart';
(...skipping 2666 matching lines...) Expand 10 before | Expand all | Expand 10 after
2677 print(0); 2677 print(0);
2678 } else { 2678 } else {
2679 print(1); 2679 print(1);
2680 } 2680 }
2681 } 2681 }
2682 } 2682 }
2683 '''); 2683 ''');
2684 await assertNoAssistAt('if (1 ==', DartAssistKind.JOIN_IF_WITH_INNER); 2684 await assertNoAssistAt('if (1 ==', DartAssistKind.JOIN_IF_WITH_INNER);
2685 } 2685 }
2686 2686
2687 test_joinIfStatementInner_wrong_statementAfterInner() async {
2688 resolveTestUnit('''
2689 main() {
2690 if (1 == 1) {
2691 if (2 == 2) {
2692 print(2);
2693 }
2694 print(1);
2695 }
2696 }
2697 ''');
2698 await assertNoAssistAt('if (1 ==', DartAssistKind.JOIN_IF_WITH_INNER);
2699 }
2700
2701 test_joinIfStatementInner_wrong_statementBeforeInner() async {
2702 resolveTestUnit('''
2703 main() {
2704 if (1 == 1) {
2705 print(1);
2706 if (2 == 2) {
2707 print(2);
2708 }
2709 }
2710 }
2711 ''');
2712 await assertNoAssistAt('if (1 ==', DartAssistKind.JOIN_IF_WITH_INNER);
2713 }
2714
2687 test_joinIfStatementInner_wrong_targetNotIf() async { 2715 test_joinIfStatementInner_wrong_targetNotIf() async {
2688 resolveTestUnit(''' 2716 resolveTestUnit('''
2689 main() { 2717 main() {
2690 print(0); 2718 print(0);
2691 } 2719 }
2692 '''); 2720 ''');
2693 await assertNoAssistAt('print', DartAssistKind.JOIN_IF_WITH_INNER); 2721 await assertNoAssistAt('print', DartAssistKind.JOIN_IF_WITH_INNER);
2694 } 2722 }
2695 2723
2696 test_joinIfStatementInner_wrong_targetWithElse() async { 2724 test_joinIfStatementInner_wrong_targetWithElse() async {
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
2907 print(0); 2935 print(0);
2908 } 2936 }
2909 } else { 2937 } else {
2910 print(1); 2938 print(1);
2911 } 2939 }
2912 } 2940 }
2913 '''); 2941 ''');
2914 await assertNoAssistAt('if (2 == 2', DartAssistKind.JOIN_IF_WITH_OUTER); 2942 await assertNoAssistAt('if (2 == 2', DartAssistKind.JOIN_IF_WITH_OUTER);
2915 } 2943 }
2916 2944
2945 test_joinIfStatementOuter_wrong_statementAfterInner() async {
2946 resolveTestUnit('''
2947 main() {
2948 if (1 == 1) {
2949 if (2 == 2) {
2950 print(2);
2951 }
2952 print(1);
2953 }
2954 }
2955 ''');
2956 await assertNoAssistAt('if (2 == 2', DartAssistKind.JOIN_IF_WITH_OUTER);
2957 }
2958
2959 test_joinIfStatementOuter_wrong_statementBeforeInner() async {
2960 resolveTestUnit('''
2961 main() {
2962 if (1 == 1) {
2963 print(1);
2964 if (2 == 2) {
2965 print(2);
2966 }
2967 }
2968 }
2969 ''');
2970 await assertNoAssistAt('if (2 == 2', DartAssistKind.JOIN_IF_WITH_OUTER);
2971 }
2972
2917 test_joinIfStatementOuter_wrong_targetNotIf() async { 2973 test_joinIfStatementOuter_wrong_targetNotIf() async {
2918 resolveTestUnit(''' 2974 resolveTestUnit('''
2919 main() { 2975 main() {
2920 print(0); 2976 print(0);
2921 } 2977 }
2922 '''); 2978 ''');
2923 await assertNoAssistAt('print', DartAssistKind.JOIN_IF_WITH_OUTER); 2979 await assertNoAssistAt('print', DartAssistKind.JOIN_IF_WITH_OUTER);
2924 } 2980 }
2925 2981
2926 test_joinIfStatementOuter_wrong_targetWithElse() async { 2982 test_joinIfStatementOuter_wrong_targetWithElse() async {
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
3854 positions.add(new Position(testFile, offset)); 3910 positions.add(new Position(testFile, offset));
3855 } 3911 }
3856 return positions; 3912 return positions;
3857 } 3913 }
3858 3914
3859 void _setStartEndSelection() { 3915 void _setStartEndSelection() {
3860 offset = findOffset('// start\n') + '// start\n'.length; 3916 offset = findOffset('// start\n') + '// start\n'.length;
3861 length = findOffset('// end') - offset; 3917 length = findOffset('// end') - offset;
3862 } 3918 }
3863 } 3919 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/assist_internal.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698