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

Side by Side Diff: tests/compiler/dart2js/kernel/switch_test.dart

Issue 2997413002: Support --use-kernel in memory_compiler (Closed)
Patch Set: Remove hack in source_loader Created 3 years, 3 months 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
OLDNEW
1 import 'package:test/test.dart'; 1 import 'package:test/test.dart';
2 2
3 import 'helper.dart' show check; 3 import 'helper.dart' show check;
4 4
5 main() { 5 main() {
6 test('simple switch statement', () { 6 test('simple switch statement', () {
7 String code = ''' 7 String code = '''
8 main() { 8 main() {
9 int x = 2; 9 int x = 2;
10 switch(x) { 10 switch(x) {
(...skipping 17 matching lines...) Expand all
28 print('spider'); 28 print('spider');
29 break; 29 break;
30 case 2: 30 case 2:
31 print('grasshopper'); 31 print('grasshopper');
32 break; 32 break;
33 default: 33 default:
34 print('ladybug'); 34 print('ladybug');
35 35
36 } 36 }
37 }'''; 37 }''';
38 return check(code); 38 return check(code, useKernelInSsa: true);
39 }); 39 });
40 40
41 /* 41 /*
42 // TODO(efortuna): Uncomment. Because of patch file weirdness, the original 42 // TODO(efortuna): Uncomment. Because of patch file weirdness, the original
43 // SSA vs the Kernel version is instantiating a subclass of the 43 // SSA vs the Kernel version is instantiating a subclass of the
44 // FallThroughError, so it produces slightly different code. Fix that. 44 // FallThroughError, so it produces slightly different code. Fix that.
45 test('switch with fall through error', () { 45 test('switch with fall through error', () {
46 String code = ''' 46 String code = '''
47 main() { 47 main() {
48 int x = 2; 48 int x = 2;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 switch(x) { 88 switch(x) {
89 case 1: 89 case 1:
90 print('spider'); 90 print('spider');
91 break; 91 break;
92 case 5: 92 case 5:
93 print('beetle'); 93 print('beetle');
94 break; 94 break;
95 case 6: 95 case 6:
96 } 96 }
97 }'''; 97 }''';
98 return check(code); 98 return check(code, useKernelInSsa: true);
99 }); 99 });
100 100
101 test('switch with labeled continue', () { 101 test('switch with labeled continue', () {
102 String code = ''' 102 String code = '''
103 main() { 103 main() {
104 int x = 1; 104 int x = 1;
105 switch(x) { 105 switch(x) {
106 case 1: 106 case 1:
107 print('spider'); 107 print('spider');
108 continue world; 108 continue world;
109 case 5: 109 case 5:
110 print('beetle'); 110 print('beetle');
111 break; 111 break;
112 world: 112 world:
113 case 6: 113 case 6:
114 print('cricket'); 114 print('cricket');
115 break; 115 break;
116 default: 116 default:
117 print('bat'); 117 print('bat');
118 } 118 }
119 }'''; 119 }''';
120 return check(code); 120 return check(code, useKernelInSsa: true);
121 }); 121 });
122 122
123 test('switch with continue to fall through', () { 123 test('switch with continue to fall through', () {
124 String code = ''' 124 String code = '''
125 main() { 125 main() {
126 int x = 1; 126 int x = 1;
127 switch(x) { 127 switch(x) {
128 case 1: 128 case 1:
129 print('spider'); 129 print('spider');
130 continue world; 130 continue world;
131 world: 131 world:
132 case 5: 132 case 5:
133 print('beetle'); 133 print('beetle');
134 break; 134 break;
135 case 6: 135 case 6:
136 print('cricket'); 136 print('cricket');
137 break; 137 break;
138 default: 138 default:
139 print('bat'); 139 print('bat');
140 } 140 }
141 }'''; 141 }''';
142 return check(code); 142 return check(code, useKernelInSsa: true);
143 }); 143 });
144 144
145 test('switch with continue without default case', () { 145 test('switch with continue without default case', () {
146 String code = ''' 146 String code = '''
147 main() { 147 main() {
148 int x = 1; 148 int x = 1;
149 switch(x) { 149 switch(x) {
150 case 1: 150 case 1:
151 print('spider'); 151 print('spider');
152 continue world; 152 continue world;
153 world: 153 world:
154 case 5: 154 case 5:
155 print('beetle'); 155 print('beetle');
156 break; 156 break;
157 case 6: 157 case 6:
158 print('cricket'); 158 print('cricket');
159 break; 159 break;
160 } 160 }
161 }'''; 161 }''';
162 return check(code); 162 return check(code, useKernelInSsa: true);
163 }); 163 });
164 164
165 test('switch with continue without default case', () { 165 test('switch with continue without default case and no matching case', () {
166 String code = ''' 166 String code = '''
167 main() { 167 main() {
168 int x = 8; 168 int x = 8;
169 switch(x) { 169 switch(x) {
170 case 1: 170 case 1:
171 print('spider'); 171 print('spider');
172 continue world; 172 continue world;
173 world: 173 world:
174 case 5: 174 case 5:
175 print('beetle'); 175 print('beetle');
176 break; 176 break;
177 case 6: 177 case 6:
178 print('cricket'); 178 print('cricket');
179 break; 179 break;
180 } 180 }
181 }'''; 181 }''';
182 return check(code); 182 return check(code, useKernelInSsa: true);
183 }); 183 });
184 } 184 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/kernel/loops_test.dart ('k') | tests/compiler/dart2js/kernel/visitor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698