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

Side by Side Diff: tests/language/function_syntax_test.dart

Issue 2765893003: Fix warnings_checker.dart handling of multitests (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « tests/language/flatten_test.dart ('k') | tests/language/function_type_alias5_test.dart » ('j') | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 // Tests function statement and expression syntax. 7 // Tests function statement and expression syntax.
8 8
9 class FunctionSyntaxTest { 9 class FunctionSyntaxTest {
10 10
11 static void testMain 11 static void testMain
12 /* /// 00: compile-time error 12 /* //# 00: compile-time error
13 () 13 ()
14 */ /// 00: continued 14 */ //# 00: continued
15 { 15 {
16 testNestedFunctions(); 16 testNestedFunctions();
17 testFunctionExpressions(); 17 testFunctionExpressions();
18 testPrecedence(); 18 testPrecedence();
19 testInitializers(); 19 testInitializers();
20 testFunctionParameter(); 20 testFunctionParameter();
21 testFunctionIdentifierExpression(); 21 testFunctionIdentifierExpression();
22 testFunctionIdentifierStatement(); 22 testFunctionIdentifierStatement();
23 } 23 }
24 24
25 static void testNestedFunctions 25 static void testNestedFunctions
26 /* /// 01: compile-time error 26 /* //# 01: compile-time error
27 () 27 ()
28 */ /// 01: continued 28 */ //# 01: continued
29 { 29 {
30 // No types - braces. 30 // No types - braces.
31 nb0 31 nb0
32 /* /// 02: compile-time error 32 /* //# 02: compile-time error
33 () 33 ()
34 */ /// 02: continued 34 */ //# 02: continued
35 { return 42; } 35 { return 42; }
36 nb1 36 nb1
37 /* /// 03: compile-time error 37 /* //# 03: compile-time error
38 (a) 38 (a)
39 */ /// 03: continued 39 */ //# 03: continued
40 { return a; } 40 { return a; }
41 nb2 41 nb2
42 /* /// 04: compile-time error 42 /* //# 04: compile-time error
43 (a, b) 43 (a, b)
44 */ /// 04: continued 44 */ //# 04: continued
45 { return a + b; } 45 { return a + b; }
46 Expect.equals(42, nb0()); 46 Expect.equals(42, nb0());
47 Expect.equals(87, nb1(87)); 47 Expect.equals(87, nb1(87));
48 Expect.equals(1 + 2, nb2(1, 2)); 48 Expect.equals(1 + 2, nb2(1, 2));
49 49
50 // No types - arrows. 50 // No types - arrows.
51 na0 51 na0
52 /* /// 05: compile-time error 52 /* //# 05: compile-time error
53 () 53 ()
54 */ /// 05: continued 54 */ //# 05: continued
55 => 42; 55 => 42;
56 na1 56 na1
57 /* /// 06: compile-time error 57 /* //# 06: compile-time error
58 (a) 58 (a)
59 */ /// 06: continued 59 */ //# 06: continued
60 => a; 60 => a;
61 na2 61 na2
62 /* /// 07: compile-time error 62 /* //# 07: compile-time error
63 (a, b) 63 (a, b)
64 */ /// 07: continued 64 */ //# 07: continued
65 => a + b; 65 => a + b;
66 Expect.equals(42, na0()); 66 Expect.equals(42, na0());
67 Expect.equals(87, na1(87)); 67 Expect.equals(87, na1(87));
68 Expect.equals(1 + 2, na2(1, 2)); 68 Expect.equals(1 + 2, na2(1, 2));
69 69
70 // Return type - braces. 70 // Return type - braces.
71 int rb0 71 int rb0
72 /* /// 08: compile-time error 72 /* //# 08: compile-time error
73 () 73 ()
74 */ /// 08: continued 74 */ //# 08: continued
75 { return 42; } 75 { return 42; }
76 int rb1 76 int rb1
77 /* /// 09: compile-time error 77 /* //# 09: compile-time error
78 (a) 78 (a)
79 */ /// 09: continued 79 */ //# 09: continued
80 { return a; } 80 { return a; }
81 int rb2 81 int rb2
82 /* /// 10: compile-time error 82 /* //# 10: compile-time error
83 (a, b) 83 (a, b)
84 */ /// 10: continued 84 */ //# 10: continued
85 { return a + b; } 85 { return a + b; }
86 Expect.equals(42, rb0()); 86 Expect.equals(42, rb0());
87 Expect.equals(87, rb1(87)); 87 Expect.equals(87, rb1(87));
88 Expect.equals(1 + 2, rb2(1, 2)); 88 Expect.equals(1 + 2, rb2(1, 2));
89 89
90 // Return type - arrows. 90 // Return type - arrows.
91 int ra0 91 int ra0
92 /* /// 11: compile-time error 92 /* //# 11: compile-time error
93 () 93 ()
94 */ /// 11: continued 94 */ //# 11: continued
95 => 42; 95 => 42;
96 int ra1 96 int ra1
97 /* /// 12: compile-time error 97 /* //# 12: compile-time error
98 (a) 98 (a)
99 */ /// 12: continued 99 */ //# 12: continued
100 => a; 100 => a;
101 int ra2 101 int ra2
102 /* /// 13: compile-time error 102 /* //# 13: compile-time error
103 (a, b) 103 (a, b)
104 */ /// 13: continued 104 */ //# 13: continued
105 => a + b; 105 => a + b;
106 Expect.equals(42, ra0()); 106 Expect.equals(42, ra0());
107 Expect.equals(87, ra1(87)); 107 Expect.equals(87, ra1(87));
108 Expect.equals(1 + 2, ra2(1, 2)); 108 Expect.equals(1 + 2, ra2(1, 2));
109 109
110 // Fully typed - braces. 110 // Fully typed - braces.
111 int fb1 111 int fb1
112 /* /// 14: compile-time error 112 /* //# 14: compile-time error
113 (int a) 113 (int a)
114 */ /// 14: continued 114 */ //# 14: continued
115 { return a; } 115 { return a; }
116 int fb2 116 int fb2
117 /* /// 15: compile-time error 117 /* //# 15: compile-time error
118 (int a, int b) 118 (int a, int b)
119 */ /// 15: continued 119 */ //# 15: continued
120 { return a + b; } 120 { return a + b; }
121 Expect.equals(42, rb0()); 121 Expect.equals(42, rb0());
122 Expect.equals(87, rb1(87)); 122 Expect.equals(87, rb1(87));
123 Expect.equals(1 + 2, rb2(1, 2)); 123 Expect.equals(1 + 2, rb2(1, 2));
124 124
125 // Fully typed - arrows. 125 // Fully typed - arrows.
126 int fa1 126 int fa1
127 /* /// 16: compile-time error 127 /* //# 16: compile-time error
128 (int a) 128 (int a)
129 */ /// 16: continued 129 */ //# 16: continued
130 => a; 130 => a;
131 int fa2 131 int fa2
132 /* /// 17: compile-time error 132 /* //# 17: compile-time error
133 (int a, int b) 133 (int a, int b)
134 */ /// 17: continued 134 */ //# 17: continued
135 => a + b; 135 => a + b;
136 Expect.equals(42, ra0()); 136 Expect.equals(42, ra0());
137 Expect.equals(87, ra1(87)); 137 Expect.equals(87, ra1(87));
138 Expect.equals(1 + 2, ra2(1, 2)); 138 Expect.equals(1 + 2, ra2(1, 2));
139 139
140 // Generic types - braces. 140 // Generic types - braces.
141 List<int> gb0 141 List<int> gb0
142 /* /// 18: compile-time error 142 /* //# 18: compile-time error
143 () 143 ()
144 */ /// 18: continued 144 */ //# 18: continued
145 { return [42]; } 145 { return [42]; }
146 List<int> gb1 146 List<int> gb1
147 /* /// 19: compile-time error 147 /* //# 19: compile-time error
148 (List<int> a) 148 (List<int> a)
149 */ /// 19: continued 149 */ //# 19: continued
150 { return a; } 150 { return a; }
151 Expect.equals(42, gb0()[0]); 151 Expect.equals(42, gb0()[0]);
152 Expect.equals(87, gb1([87])[0]); 152 Expect.equals(87, gb1([87])[0]);
153 153
154 // Generic types - arrows. 154 // Generic types - arrows.
155 List<int> ga0 155 List<int> ga0
156 /* /// 20: compile-time error 156 /* //# 20: compile-time error
157 () 157 ()
158 */ /// 20: continued 158 */ //# 20: continued
159 => [42]; 159 => [42];
160 List<int> ga1 160 List<int> ga1
161 /* /// 21: compile-time error 161 /* //# 21: compile-time error
162 (List<int> a) 162 (List<int> a)
163 */ /// 21: continued 163 */ //# 21: continued
164 => a; 164 => a;
165 Expect.equals(42, ga0()[0]); 165 Expect.equals(42, ga0()[0]);
166 Expect.equals(87, ga1([87])[0]); 166 Expect.equals(87, ga1([87])[0]);
167 } 167 }
168 168
169 static void testFunctionExpressions 169 static void testFunctionExpressions
170 /* /// 22: compile-time error 170 /* //# 22: compile-time error
171 () 171 ()
172 */ /// 22: continued 172 */ //# 22: continued
173 { 173 {
174 eval0 174 eval0
175 /* /// 23: compile-time error 175 /* //# 23: compile-time error
176 (fn) 176 (fn)
177 */ /// 23: continued 177 */ //# 23: continued
178 => fn(); 178 => fn();
179 eval1 179 eval1
180 /* /// 24: compile-time error 180 /* //# 24: compile-time error
181 (fn, a) 181 (fn, a)
182 */ /// 24: continued 182 */ //# 24: continued
183 => fn(a); 183 => fn(a);
184 eval2 184 eval2
185 /* /// 25: compile-time error 185 /* //# 25: compile-time error
186 (fn, a, b) 186 (fn, a, b)
187 */ /// 25: continued 187 */ //# 25: continued
188 => fn(a, b); 188 => fn(a, b);
189 189
190 // No types - braces. 190 // No types - braces.
191 Expect.equals(42, eval0( 191 Expect.equals(42, eval0(
192 /* /// 26: compile-time error 192 /* //# 26: compile-time error
193 () 193 ()
194 */ /// 26: continued 194 */ //# 26: continued
195 { return 42; })); 195 { return 42; }));
196 Expect.equals(87, eval1( 196 Expect.equals(87, eval1(
197 /* /// 27: compile-time error 197 /* //# 27: compile-time error
198 (a) 198 (a)
199 */ /// 27: continued 199 */ //# 27: continued
200 { return a; }, 87)); 200 { return a; }, 87));
201 Expect.equals(1 + 2, eval2( 201 Expect.equals(1 + 2, eval2(
202 /* /// 28: compile-time error 202 /* //# 28: compile-time error
203 (a, b) 203 (a, b)
204 */ /// 28: continued 204 */ //# 28: continued
205 { return a + b; }, 1, 2)); 205 { return a + b; }, 1, 2));
206 Expect.equals(42, eval0( 206 Expect.equals(42, eval0(
207 /* /// 29: compile-time error 207 /* //# 29: compile-time error
208 () 208 ()
209 */ /// 29: continued 209 */ //# 29: continued
210 { return 42; })); 210 { return 42; }));
211 Expect.equals(87, eval1( 211 Expect.equals(87, eval1(
212 /* /// 30: compile-time error 212 /* //# 30: compile-time error
213 (a) 213 (a)
214 */ /// 30: continued 214 */ //# 30: continued
215 { return a; }, 87)); 215 { return a; }, 87));
216 Expect.equals(1 + 2, eval2( 216 Expect.equals(1 + 2, eval2(
217 /* /// 31: compile-time error 217 /* //# 31: compile-time error
218 (a, b) 218 (a, b)
219 */ /// 31: continued 219 */ //# 31: continued
220 { return a + b; }, 1, 2)); 220 { return a + b; }, 1, 2));
221 221
222 // No types - arrows. 222 // No types - arrows.
223 Expect.equals(42, eval0( 223 Expect.equals(42, eval0(
224 /* /// 32: compile-time error 224 /* //# 32: compile-time error
225 () 225 ()
226 */ /// 32: continued 226 */ //# 32: continued
227 => 42)); 227 => 42));
228 Expect.equals(87, eval1( 228 Expect.equals(87, eval1(
229 /* /// 33: compile-time error 229 /* //# 33: compile-time error
230 (a) 230 (a)
231 */ /// 33: continued 231 */ //# 33: continued
232 => a, 87)); 232 => a, 87));
233 Expect.equals(1 + 2, eval2( 233 Expect.equals(1 + 2, eval2(
234 /* /// 34: compile-time error 234 /* //# 34: compile-time error
235 (a, b) 235 (a, b)
236 */ /// 34: continued 236 */ //# 34: continued
237 => a + b, 1, 2)); 237 => a + b, 1, 2));
238 Expect.equals(42, eval0( 238 Expect.equals(42, eval0(
239 /* /// 35: compile-time error 239 /* //# 35: compile-time error
240 () 240 ()
241 */ /// 35: continued 241 */ //# 35: continued
242 => 42)); 242 => 42));
243 Expect.equals(87, eval1( 243 Expect.equals(87, eval1(
244 /* /// 36: compile-time error 244 /* //# 36: compile-time error
245 (a) 245 (a)
246 */ /// 36: continued 246 */ //# 36: continued
247 => a, 87)); 247 => a, 87));
248 Expect.equals(1 + 2, eval2( 248 Expect.equals(1 + 2, eval2(
249 /* /// 37: compile-time error 249 /* //# 37: compile-time error
250 (a, b) 250 (a, b)
251 */ /// 37: continued 251 */ //# 37: continued
252 => a + b, 1, 2)); 252 => a + b, 1, 2));
253 253
254 // Argument types - braces. 254 // Argument types - braces.
255 Expect.equals(42, eval0( 255 Expect.equals(42, eval0(
256 /* /// 44: compile-time error 256 /* //# 44: compile-time error
257 () 257 ()
258 */ /// 44: continued 258 */ //# 44: continued
259 { return 42; })); 259 { return 42; }));
260 Expect.equals(87, eval1( 260 Expect.equals(87, eval1(
261 /* /// 45: compile-time error 261 /* //# 45: compile-time error
262 (int a) 262 (int a)
263 */ /// 45: continued 263 */ //# 45: continued
264 { return a; }, 87)); 264 { return a; }, 87));
265 Expect.equals(1 + 2, eval2( 265 Expect.equals(1 + 2, eval2(
266 /* /// 46: compile-time error 266 /* //# 46: compile-time error
267 (int a, int b) 267 (int a, int b)
268 */ /// 46: continued 268 */ //# 46: continued
269 { return a + b; }, 1, 2)); 269 { return a + b; }, 1, 2));
270 Expect.equals(42, eval0( 270 Expect.equals(42, eval0(
271 /* /// 47: compile-time error 271 /* //# 47: compile-time error
272 () 272 ()
273 */ /// 47: continued 273 */ //# 47: continued
274 { return 42; })); 274 { return 42; }));
275 Expect.equals(87, eval1( 275 Expect.equals(87, eval1(
276 /* /// 48: compile-time error 276 /* //# 48: compile-time error
277 (int a) 277 (int a)
278 */ /// 48: continued 278 */ //# 48: continued
279 { return a; }, 87)); 279 { return a; }, 87));
280 Expect.equals(1 + 2, eval2( 280 Expect.equals(1 + 2, eval2(
281 /* /// 49: compile-time error 281 /* //# 49: compile-time error
282 (int a, int b) 282 (int a, int b)
283 */ /// 49: continued 283 */ //# 49: continued
284 { return a + b; }, 1, 2)); 284 { return a + b; }, 1, 2));
285 285
286 // Argument types - arrows. 286 // Argument types - arrows.
287 Expect.equals(42, eval0( 287 Expect.equals(42, eval0(
288 /* /// 50: compile-time error 288 /* //# 50: compile-time error
289 () 289 ()
290 */ /// 50: continued 290 */ //# 50: continued
291 => 42)); 291 => 42));
292 Expect.equals(87, eval1( 292 Expect.equals(87, eval1(
293 /* /// 51: compile-time error 293 /* //# 51: compile-time error
294 (int a) 294 (int a)
295 */ /// 51: continued 295 */ //# 51: continued
296 => a, 87)); 296 => a, 87));
297 Expect.equals(1 + 2, eval2( 297 Expect.equals(1 + 2, eval2(
298 /* /// 52: compile-time error 298 /* //# 52: compile-time error
299 (int a, int b) 299 (int a, int b)
300 */ /// 52: continued 300 */ //# 52: continued
301 => a + b, 1, 2)); 301 => a + b, 1, 2));
302 Expect.equals(42, eval0( 302 Expect.equals(42, eval0(
303 /* /// 53: compile-time error 303 /* //# 53: compile-time error
304 () 304 ()
305 */ /// 53: continued 305 */ //# 53: continued
306 => 42)); 306 => 42));
307 Expect.equals(87, eval1( 307 Expect.equals(87, eval1(
308 /* /// 54: compile-time error 308 /* //# 54: compile-time error
309 (int a) 309 (int a)
310 */ /// 54: continued 310 */ //# 54: continued
311 => a, 87)); 311 => a, 87));
312 Expect.equals(1 + 2, eval2( 312 Expect.equals(1 + 2, eval2(
313 /* /// 55: compile-time error 313 /* //# 55: compile-time error
314 (int a, int b) 314 (int a, int b)
315 */ /// 55: continued 315 */ //# 55: continued
316 => a + b, 1, 2)); 316 => a + b, 1, 2));
317 317
318 } 318 }
319 319
320 static void testPrecedence 320 static void testPrecedence
321 /* /// 64: compile-time error 321 /* //# 64: compile-time error
322 () 322 ()
323 */ /// 64: continued 323 */ //# 64: continued
324 { 324 {
325 expectEvaluatesTo 325 expectEvaluatesTo
326 /* /// 65: compile-time error 326 /* //# 65: compile-time error
327 (value, fn) 327 (value, fn)
328 */ /// 65: continued 328 */ //# 65: continued
329 { Expect.equals(value, fn()); } 329 { Expect.equals(value, fn()); }
330 330
331 // Assignment. 331 // Assignment.
332 var x; 332 var x;
333 expectEvaluatesTo(42, ()=> x = 42); 333 expectEvaluatesTo(42, ()=> x = 42);
334 Expect.equals(42, x); 334 Expect.equals(42, x);
335 x = 1; 335 x = 1;
336 expectEvaluatesTo(100, ()=> x += 99); 336 expectEvaluatesTo(100, ()=> x += 99);
337 Expect.equals(100, x); 337 Expect.equals(100, x);
338 x = 1; 338 x = 1;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 // Postfix / prefix. 396 // Postfix / prefix.
397 var y = 0; 397 var y = 0;
398 expectEvaluatesTo(0, ()=> y++); 398 expectEvaluatesTo(0, ()=> y++);
399 expectEvaluatesTo(2, ()=> ++y); 399 expectEvaluatesTo(2, ()=> ++y);
400 expectEvaluatesTo(1, ()=> --y); 400 expectEvaluatesTo(1, ()=> --y);
401 expectEvaluatesTo(1, ()=> y--); 401 expectEvaluatesTo(1, ()=> y--);
402 Expect.equals(0, y); 402 Expect.equals(0, y);
403 403
404 // Selector. 404 // Selector.
405 fn 405 fn
406 /* /// 66: compile-time error 406 /* //# 66: compile-time error
407 () 407 ()
408 */ /// 66: continued 408 */ //# 66: continued
409 => 42; 409 => 42;
410 var list = [87]; 410 var list = [87];
411 expectEvaluatesTo(42, ()=> fn()); 411 expectEvaluatesTo(42, ()=> fn());
412 expectEvaluatesTo(1, ()=> list.length); 412 expectEvaluatesTo(1, ()=> list.length);
413 expectEvaluatesTo(87, ()=> list[0]); 413 expectEvaluatesTo(87, ()=> list[0]);
414 expectEvaluatesTo(87, ()=> list.removeLast()); 414 expectEvaluatesTo(87, ()=> list.removeLast());
415 } 415 }
416 416
417 static void testInitializers 417 static void testInitializers
418 /* /// 67: compile-time error 418 /* //# 67: compile-time error
419 () 419 ()
420 */ /// 67: continued 420 */ //# 67: continued
421 { 421 {
422 Expect.equals(42, (new C.cb0().fn)()); 422 Expect.equals(42, (new C.cb0().fn)());
423 Expect.equals(43, (new C.ca0().fn)()); 423 Expect.equals(43, (new C.ca0().fn)());
424 Expect.equals(44, (new C.cb1().fn)()); 424 Expect.equals(44, (new C.cb1().fn)());
425 Expect.equals(45, (new C.ca1().fn)()); 425 Expect.equals(45, (new C.ca1().fn)());
426 Expect.equals(46, (new C.cb2().fn)()); 426 Expect.equals(46, (new C.cb2().fn)());
427 Expect.equals(47, (new C.ca2().fn)()); 427 Expect.equals(47, (new C.ca2().fn)());
428 Expect.equals(48, (new C.cb3().fn)()); 428 Expect.equals(48, (new C.cb3().fn)());
429 Expect.equals(49, (new C.ca3().fn)()); 429 Expect.equals(49, (new C.ca3().fn)());
430 430
(...skipping 10 matching lines...) Expand all
441 Expect.equals(63, (new C.ra0().fn)()); 441 Expect.equals(63, (new C.ra0().fn)());
442 Expect.equals(64, (new C.rb1().fn)()); 442 Expect.equals(64, (new C.rb1().fn)());
443 Expect.equals(65, (new C.ra1().fn)()); 443 Expect.equals(65, (new C.ra1().fn)());
444 Expect.equals(66, (new C.rb2().fn)()); 444 Expect.equals(66, (new C.rb2().fn)());
445 Expect.equals(67, (new C.ra2().fn)()); 445 Expect.equals(67, (new C.ra2().fn)());
446 Expect.equals(68, (new C.rb3().fn)()); 446 Expect.equals(68, (new C.rb3().fn)());
447 Expect.equals(69, (new C.ra3().fn)()); 447 Expect.equals(69, (new C.ra3().fn)());
448 } 448 }
449 449
450 static void testFunctionParameter 450 static void testFunctionParameter
451 /* /// 68: compile-time error 451 /* //# 68: compile-time error
452 () 452 ()
453 */ /// 68: continued 453 */ //# 68: continued
454 { 454 {
455 f0(fn()) => fn(); 455 f0(fn()) => fn();
456 Expect.equals(42, f0(()=> 42)); 456 Expect.equals(42, f0(()=> 42));
457 457
458 f1(int fn()) => fn(); 458 f1(int fn()) => fn();
459 Expect.equals(87, f1(()=> 87)); 459 Expect.equals(87, f1(()=> 87));
460 460
461 f2(fn(a)) => fn(42); 461 f2(fn(a)) => fn(42);
462 Expect.equals(43, f2((a)=> a + 1)); 462 Expect.equals(43, f2((a)=> a + 1));
463 463
464 f3(fn(int a)) => fn(42); 464 f3(fn(int a)) => fn(42);
465 Expect.equals(44, f3((int a)=> a + 2)); 465 Expect.equals(44, f3((int a)=> a + 2));
466 } 466 }
467 467
468 static void testFunctionIdentifierExpression 468 static void testFunctionIdentifierExpression
469 /* /// 69: compile-time error 469 /* //# 69: compile-time error
470 () 470 ()
471 */ /// 69: continued 471 */ //# 69: continued
472 { 472 {
473 Expect.equals(87, ( 473 Expect.equals(87, (
474 /* /// 70: compile-time error 474 /* //# 70: compile-time error
475 () 475 ()
476 */ /// 70: continued 476 */ //# 70: continued
477 => 87)()); 477 => 87)());
478 } 478 }
479 479
480 static void testFunctionIdentifierStatement 480 static void testFunctionIdentifierStatement
481 /* /// 71: compile-time error 481 /* //# 71: compile-time error
482 () 482 ()
483 */ /// 71: continued 483 */ //# 71: continued
484 { 484 {
485 function 485 function
486 /* /// 72: compile-time error 486 /* //# 72: compile-time error
487 () 487 ()
488 */ /// 72: continued 488 */ //# 72: continued
489 => 42; 489 => 42;
490 Expect.equals(42, function()); 490 Expect.equals(42, function());
491 Expect.equals(true, function is Function); 491 Expect.equals(true, function is Function);
492 } 492 }
493 493
494 } 494 }
495 495
496 496
497 class C { 497 class C {
498 498
(...skipping 27 matching lines...) Expand all
526 C.rb1() : fn = wrap(() { return 64; }) { } 526 C.rb1() : fn = wrap(() { return 64; }) { }
527 C.ra1() : fn = wrap(()=> 65) { } 527 C.ra1() : fn = wrap(()=> 65) { }
528 528
529 C.rb2() : fn = [() { return 66; }][0] { } 529 C.rb2() : fn = [() { return 66; }][0] { }
530 C.ra2() : fn = [() => 67][0] { } 530 C.ra2() : fn = [() => 67][0] { }
531 531
532 C.rb3() : fn = {'x': () { return 68; }}['x'] { } 532 C.rb3() : fn = {'x': () { return 68; }}['x'] { }
533 C.ra3() : fn = {'x': () => 69}['x'] { } 533 C.ra3() : fn = {'x': () => 69}['x'] { }
534 534
535 static wrap 535 static wrap
536 /* /// 73: compile-time error 536 /* //# 73: compile-time error
537 (fn) 537 (fn)
538 */ /// 73: continued 538 */ //# 73: continued
539 { return fn; } 539 { return fn; }
540 540
541 final fn; 541 final fn;
542 542
543 } 543 }
544 544
545 main 545 main
546 /* /// 74: compile-time error 546 /* //# 74: compile-time error
547 () 547 ()
548 */ /// 74: continued 548 */ //# 74: continued
549 { 549 {
550 FunctionSyntaxTest.testMain(); 550 FunctionSyntaxTest.testMain();
551 } 551 }
OLDNEW
« no previous file with comments | « tests/language/flatten_test.dart ('k') | tests/language/function_type_alias5_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698