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

Side by Side Diff: tests/language_strong/async_await_syntax_test.dart

Issue 2992003002: Migrate block 37, language/arithmetic2 ... /async_await_syntax_test. (Closed)
Patch Set: Revise. Created 3 years, 4 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
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
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.
4
5 // Test async/await syntax.
6
7 import 'dart:async' show Stream;
8
9 var yield = 0;
10 var await = 0;
11 get st => new Stream.fromIterable([]);
12
13 a01a() async => null; // //# a01a: ok
14 a01b() async* => null; // //# a01b: compile-time error
15 a01c() sync* => null; // //# a01c: compile-time error
16 a01d() async => yield 5; // //# a01d: compile-time error
17 a02a() async {} // //# a02a: ok
18 a03a() async* {} // //# a03a: ok
19 a03b() async * {} // //# a03b: ok
20 a04a() sync* {} // //# a04a: ok
21 a04b() sync {} // //# a04b: compile-time error
22 a04c() sync * {} // //# a04c: ok
23 a05a() async { await 0; } // //# a05a: ok
24 a05b() async { // //# a05b: ok
25 await(a) {}; // //# a05b: continued
26 await(0); // //# a05b: continued
27 } // //# a05b: continued
28 a05c() { // //# a05c: ok
29 await(a) {}; // //# a05c: continued
30 await(0); // //# a05c: continued
31 } // //# a05c: continued
32 a05d() async { // //# a05d: compile-time error
33 await(a) {} // //# a05d: continued
34 await(0); // //# a05d: continued
35 } // //# a05d: continued
36 a05e() { // //# a05e: ok
37 await(a) {} // //# a05e: continued
38 await(0); // //# a05e: continued
39 } // //# a05e: continued
40 a05f() async { // //# a05f: compile-time error
41 var await = (a) {}; // //# a05f: continued
42 await(0); // //# a05f: continued
43 } // //# a05f: continued
44 a05g() async { // //# a05g: continued
45 yield 5; // //# a05g: compile-time error
46 } // //# a05g: continued
47 a05h() async { // //# a05h: continued
48 yield* st; // //# a05h: compile-time error
49 } // //# a05h: continued
50 a06a() async { await for (var o in st) {} } // //# a06a: ok
51 a06b() sync* { await for (var o in st) {} } // //# a06b: compile-time error
52 a07a() sync* { yield 0; } // //# a07a: ok
53 a07b() sync { yield 0; } // //# a07b: compile-time error
54 a08a() sync* { yield* []; } // //# a08a: ok
55 a08b() sync { yield 0; } // //# a08b: compile-time error
56 a09a() async* { yield 0; } // //# a09a: ok
57 a10a() async* { yield* []; } // //# a10a: static type warning
58
59 get sync sync {} // //# a11a: compile-time error
60 get sync sync* {} // //# a11b: ok
61 get async async {} // //# a11c: ok
62 get async async* {} // //# a11d: ok
63
64 get sync {} // //# a12a: ok
65 get sync* {} // //# a12b: compile-time error
66 get async {} // //# a12c: ok
67 get async* {} // //# a12d: compile-time error
68 get a12e sync* => null; // //# a12e: compile-time error
69 get a12f async* => null; // //# a12f: compile-time error
70 get a12g async => null; // //# a12g: ok
71
72 int sync; // //# a13a: ok
73 int sync*; // //# a13b: compile-time error
74 int async; // //# a13c: ok
75 int async*; // //# a13d: compile-time error
76
77 var sync; // //# a14a: ok
78 var sync*; // //# a14b: compile-time error
79 var async; // //# a14c: ok
80 var async*; // //# a14d: compile-time error
81
82 sync() {} // //# a15a: ok
83 sync*() {} // //# a15b: compile-time error
84 async() {} // //# a15c: ok
85 async*() {} // //# a15d: compile-time error
86
87 abstract class B {
88 b00a() async; // //# b00a: compile-time error
89 b00b() async*; // //# b00b: compile-time error
90 b00c() sync*; // //# b00c: compile-time error
91 b00d() sync; // //# b00d: compile-time error
92 }
93
94 class C extends B {
95 C();
96
97 factory C.e1() async { return null; } // //# e1: compile-time error
98 factory C.e2() async* { return null; } // //# e2: compile-time error
99 factory C.e3() sync* { return null; } // //# e3: compile-time error
100 factory C.e4() async = C; // //# e4: compile-time error
101 factory C.e5() async* = C; // //# e5: compile-time error
102 factory C.e6() sync* = C; // //# e6: compile-time error
103 C.e7() async {} // //# e7: compile-time error
104 C.e8() async* {} // //# e8: compile-time error
105 C.e9() sync* {} // //# e9: compile-time error
106
107 b00a() {} // //# b00a: continued
108 b00b() {} // //# b00b: continued
109 b00c() {} // //# b00c: continued
110 b00d() {} // //# b00d: continued
111
112 b01a() async => null; // //# b01a: ok
113 b01b() async* => null; // //# b01b: compile-time error
114 b01c() sync* => null; // //# b01c: compile-time error
115 b02a() async {} // //# b02a: ok
116 b03a() async* {} // //# b03a: ok
117 b04a() sync* {} // //# b04a: ok
118 b04b() sync {} // //# b04b: compile-time error
119 b05a() async { await 0; } // //# b05a: ok
120 b06a() async { await for (var o in st) {} } // //# b06a: ok
121 b06b() async { await for ( ; ; ) {} } // //# b06b: compile-time error
122 b07a() sync* { yield 0; } // //# b07a: ok
123 b08a() sync* { yield* []; } // //# b08a: ok
124 b09a() async* { yield 0; } // //# b09a: ok
125 b10a() async* { yield* []; } // //# b10a: static type warning
126 b10b() async { yield 0; } // //# b10b: compile-time error
127
128 get sync sync {} // //# b11a: compile-time error
129 get sync sync* {} // //# b11b: ok
130 get async async {} // //# b11c: ok
131 get async async* {} // //# b11d: ok
132
133 get sync {} // //# b12a: ok
134 get sync* {} // //# b12b: compile-time error
135 get async {} // //# b12c: ok
136 get async* {} // //# b12d: compile-time error
137 get b12e sync* => null; // //# b12e: compile-time error
138 get b12f async* => null; // //# b12f: compile-time error
139 get b12g async => null; // //# b12g: ok
140
141 int sync; // //# b13a: ok
142 int sync*; // //# b13b: compile-time error
143 int async; // //# b13c: ok
144 int async*; // //# b13d: compile-time error
145
146 var sync; // //# b14a: ok
147 var sync*; // //# b14b: compile-time error
148 var async; // //# b14c: ok
149 var async*; // //# b14d: compile-time error
150
151 sync() {} // //# b15a: ok
152 sync*() {} // //# b15b: compile-time error
153 async() {} // //# b15c: ok
154 async*() {} // //# b15d: compile-time error
155 }
156
157 method1() {
158 c01a() async => null; c01a(); // //# c01a: ok
159 c01b() async* => null; c01b(); // //# c01b: compile-time error
160 c01c() sync* => null; c01c(); // //# c01c: compile-time error
161 c02a() async {} c02a(); // //# c02a: ok
162 c03a() async* {} c03a(); // //# c03a: ok
163 c04a() sync* {} c04a(); // //# c04a: ok
164 c04b() sync {} c04b(); // //# c04b: compile-time error
165 c05a() async { await 0; } c05a(); // //# c05a: ok
166 c06a() async { await for (var o in st) {} } c06a(); // //# c06a: ok
167 c07a() sync* { yield 0; } c07a(); // //# c07a: ok
168 c08a() sync* { yield* []; } c08a(); // //# c08a: ok
169 c09a() async* { yield 0; } c09a(); // //# c09a: ok
170 c10a() async* { yield* []; } c10a(); // //# c10a: static type w arning
171 c11a() async { yield -5; } c11a(); // //# c11a: compile-time error
172 c11b() async { yield* st; } c11b(); // //# c11b: compile-time error
173 }
174
175 method2() {
176 var d01a = () async => null; d01a(); // //# d01a: ok
177 var d01b = () async* => null; d01b(); // //# d01b: compi le-time error
178 var d01c = () sync* => null; d01c(); // //# d01c: compi le-time error
179 var d02a = () async {}; d02a(); // //# d02a: ok
180 var d03a = () async* {}; d03a(); // //# d03a: ok
181 var d04a = () sync* {}; d04a(); // //# d04a: ok
182 var d04b = () sync {}; d04b(); // //# d04b: compi le-time error
183 var d05a = () async { await 0; }; d05a(); // //# d05a: ok
184 var d06a = () async { await for (var o in st) {} }; d06a(); // //# d06a: ok
185 var d07a = () sync* { yield 0; }; d07a(); // //# d07a: ok
186 var d08a = () sync* { yield* []; }; d08a(); // //# d08a: ok
187 var d08b = () sync* { yield*0+1; }; d08b(); // //# d08b: stati c type warning
188 var d08c = () { yield*0+1; }; d08c(); // //# d08c: ok
189 var d09a = () async* { yield 0; }; d09a(); // //# d09a: ok
190 var d10a = () async* { yield* []; }; d10a(); // //# d10a: stati c type warning
191 }
192
193 void main() {
194 var a;
195 var c = new C();
196 c = new C.e1(); //# e1: continued
197 c = new C.e2(); //# e2: continued
198 c = new C.e3(); //# e3: continued
199 c = new C.e4(); //# e4: continued
200 c = new C.e5(); //# e5: continued
201 c = new C.e6(); //# e6: continued
202 c = new C.e7(); //# e7: continued
203 c = new C.e8(); //# e8: continued
204 c = new C.e9(); //# e9: continued
205
206 a01a(); // //# a01a: continued
207 a01b(); // //# a01b: continued
208 a01c(); // //# a01c: continued
209 a01d(); // //# a01d: continued
210 a02a(); // //# a02a: continued
211 a03a(); // //# a03a: continued
212 a03b(); // //# a03b: continued
213 a04a(); // //# a04a: continued
214 a04b(); // //# a04b: continued
215 a04c(); // //# a04c: continued
216 a05a(); // //# a05a: continued
217 a05b(); // //# a05b: continued
218 a05c(); // //# a05c: continued
219 a05d(); // //# a05d: continued
220 a05e(); // //# a05e: continued
221 a05f(); // //# a05f: continued
222 a05g(); // //# a05g: continued
223 a05h(); // //# a05h: continued
224 a06a(); // //# a06a: continued
225 a06b(); // //# a06b: continued
226 a07a(); // //# a07a: continued
227 a07b(); // //# a07b: continued
228 a08a(); // //# a08a: continued
229 a08b(); // //# a08b: continued
230 a09a(); // //# a09a: continued
231 a10a(); // //# a10a: continued
232 a = sync; // //# a11a: continued
233 a = sync; // //# a11b: continued
234 a = async; // //# a11c: continued
235 a = async; // //# a11d: continued
236 a = sync; // //# a12a: continued
237 a = sync; // //# a12b: continued
238 a = async; // //# a12c: continued
239 a = async; // //# a12d: continued
240 a = a12e; // //# a12e: continued
241 a = a12f; // //# a12f: continued
242 a = a12g; // //# a12g: continued
243 a = sync; // //# a13a: continued
244 a = sync; // //# a13b: continued
245 a = async; // //# a13c: continued
246 a = async; // //# a13d: continued
247 a = sync; // //# a14a: continued
248 a = sync; // //# a14b: continued
249 a = async; // //# a14c: continued
250 a = async; // //# a14d: continued
251 sync(); // //# a15a: continued
252 sync(); // //# a15b: continued
253 async(); // //# a15c: continued
254 async(); // //# a15d: continued
255
256 c.b00a(); // //# b00a: continued
257 c.b00b(); // //# b00b: continued
258 c.b00c(); // //# b00c: continued
259 c.b00d(); // //# b00d: continued
260 c.b01a(); // //# b01a: continued
261 c.b01b(); // //# b01b: continued
262 c.b01c(); // //# b01c: continued
263 c.b02a(); // //# b02a: continued
264 c.b03a(); // //# b03a: continued
265 c.b04a(); // //# b04a: continued
266 c.b04b(); // //# b04b: continued
267 c.b05a(); // //# b05a: continued
268 c.b06a(); // //# b06a: continued
269 c.b06b(); // //# b06b: continued
270 c.b07a(); // //# b07a: continued
271 c.b08a(); // //# b08a: continued
272 c.b09a(); // //# b09a: continued
273 c.b10a(); // //# b10a: continued
274 c.b10b(); // //# b10b: continued
275 a = c.sync; // //# b11a: continued
276 a = c.sync; // //# b11b: continued
277 a = c.async; // //# b11c: continued
278 a = c.async; // //# b11d: continued
279 a = c.sync; // //# b12a: continued
280 a = c.sync; // //# b12b: continued
281 a = c.async; // //# b12c: continued
282 a = c.async; // //# b12d: continued
283 a = c.b12e; // //# b12e: continued
284 a = c.b12f; // //# b12f: continued
285 a = c.b12g; // //# b12g: continued
286 a = c.sync; // //# b13a: continued
287 a = c.sync; // //# b13b: continued
288 a = c.async; // //# b13c: continued
289 a = c.async; // //# b13d: continued
290 a = c.sync; // //# b14a: continued
291 a = c.sync; // //# b14b: continued
292 a = c.async; // //# b14c: continued
293 a = c.async; // //# b14d: continued
294 c.sync(); // //# b15a: continued
295 c.sync(); // //# b15b: continued
296 c.async(); // //# b15c: continued
297 c.async(); // //# b15d: continued
298
299 method1();
300 method2();
301 }
OLDNEW
« no previous file with comments | « tests/language_strong/async_await_foreign_test.dart ('k') | tests/language_strong/language_strong.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698