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

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

Issue 880973005: Support async/await in dart2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use language test in unittest. Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « tests/compiler/dart2js/async_await_syntax_test.dart ('k') | tests/language/language.status » ('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) 2014, the Dart project authors. Please see the AUTHORS file 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 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 // Test async/await syntax. 5 // Test async/await syntax.
6 6
7 import 'dart:async';
floitsch 2015/02/02 14:19:09 show Stream
8
7 var yield = 0; 9 var yield = 0;
8 var await = 0; 10 var await = 0;
11 get st => new Stream.fromIterable([]);
9 12
10 a01a() async => null; /// a01a: ok 13 a01a() async => null; /// a01a: ok
11 a01b() async* => null; /// a01b: compile-time error 14 a01b() async* => null; /// a01b: compile-time error
12 a01c() sync* => null; /// a01c: compile-time error 15 a01c() sync* => null; /// a01c: compile-time error
13 a02a() async {} /// a02a: ok 16 a02a() async {} /// a02a: ok
14 a03a() async* {} /// a03a: ok 17 a03a() async* {} /// a03a: ok
15 a03b() async * {} /// a03b: compile-time error 18 a03b() async * {} /// a03b: compile-time error
16 a04a() sync* {} /// a04a: ok 19 a04a() sync* {} /// a04a: ok
17 a04b() sync {} /// a04b: compile-time error 20 a04b() sync {} /// a04b: compile-time error
18 a04c() sync * {} /// a04c: compile-time error 21 a04c() sync * {} /// a04c: compile-time error
(...skipping 11 matching lines...) Expand all
30 await(0); /// a05d: continued 33 await(0); /// a05d: continued
31 } /// a05d: continued 34 } /// a05d: continued
32 a05e() { /// a05e: ok 35 a05e() { /// a05e: ok
33 await(a) {} /// a05e: continued 36 await(a) {} /// a05e: continued
34 await(0); /// a05e: continued 37 await(0); /// a05e: continued
35 } /// a05e: continued 38 } /// a05e: continued
36 a05f() async { /// a05f: compile-time error 39 a05f() async { /// a05f: compile-time error
37 var await = (a) {}; /// a05f: continued 40 var await = (a) {}; /// a05f: continued
38 await(0); /// a05f: continued 41 await(0); /// a05f: continued
39 } /// a05f: continued 42 } /// a05f: continued
40 a06a() async { await for (var o in []) {} } /// a06a: ok 43 a06a() async { await for (var o in st) {} } /// a06a: ok
41 a06b() sync* { await for (var o in []) {} } /// a06b: compile-time error 44 a06b() sync* { await for (var o in st) {} } /// a06b: compile-time error
42 a07a() sync* { yield 0; } /// a07a: ok 45 a07a() sync* { yield 0; } /// a07a: ok
43 a07b() sync { yield 0; } /// a07b: compile-time error 46 a07b() sync { yield 0; } /// a07b: compile-time error
44 a08a() sync* { yield* []; } /// a08a: ok 47 a08a() sync* { yield* []; } /// a08a: ok
45 a08b() sync { yield 0; } /// a08b: compile-time error 48 a08b() sync { yield 0; } /// a08b: compile-time error
46 a09a() async* { yield 0; } /// a09a: ok 49 a09a() async* { yield 0; } /// a09a: ok
47 a10a() async* { yield* []; } /// a10a: ok 50 a10a() async* { yield* []; } /// a10a: ok
48 51
49 get sync sync {} /// a11a: compile-time error 52 get sync sync {} /// a11a: compile-time error
50 get sync sync* {} /// a11b: ok 53 get sync sync* {} /// a11b: ok
51 get async async {} /// a11c: ok 54 get async async {} /// a11c: ok
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 b00d() {} /// b00d: continued 100 b00d() {} /// b00d: continued
98 101
99 b01a() async => null; /// b01a: ok 102 b01a() async => null; /// b01a: ok
100 b01b() async* => null; /// b01b: compile-time error 103 b01b() async* => null; /// b01b: compile-time error
101 b01c() sync* => null; /// b01c: compile-time error 104 b01c() sync* => null; /// b01c: compile-time error
102 b02a() async {} /// b02a: ok 105 b02a() async {} /// b02a: ok
103 b03a() async* {} /// b03a: ok 106 b03a() async* {} /// b03a: ok
104 b04a() sync* {} /// b04a: ok 107 b04a() sync* {} /// b04a: ok
105 b04b() sync {} /// b04b: compile-time error 108 b04b() sync {} /// b04b: compile-time error
106 b05a() async { await 0; } /// b05a: ok 109 b05a() async { await 0; } /// b05a: ok
107 b06a() async { await for (var o in []) {} } /// b06a: ok 110 b06a() async { await for (var o in st) {} } /// b06a: ok
108 b06b() async { await for ( ; ; ) {} } /// b06b: compile-time error 111 b06b() async { await for ( ; ; ) {} } /// b06b: compile-time error
109 b07a() sync* { yield 0; } /// b07a: ok 112 b07a() sync* { yield 0; } /// b07a: ok
110 b08a() sync* { yield* []; } /// b08a: ok 113 b08a() sync* { yield* []; } /// b08a: ok
111 b09a() async* { yield 0; } /// b09a: ok 114 b09a() async* { yield 0; } /// b09a: ok
112 b10a() async* { yield* []; } /// b10a: ok 115 b10a() async* { yield* []; } /// b10a: ok
113 116
114 get sync sync {} /// b11a: compile-time error 117 get sync sync {} /// b11a: compile-time error
115 get sync sync* {} /// b11b: ok 118 get sync sync* {} /// b11b: ok
116 get async async {} /// b11c: ok 119 get async async {} /// b11c: ok
117 get async async* {} /// b11d: ok 120 get async async* {} /// b11d: ok
(...skipping 21 matching lines...) Expand all
139 142
140 method1() { 143 method1() {
141 c01a() async => null; c01a(); /// c01a: ok 144 c01a() async => null; c01a(); /// c01a: ok
142 c01b() async* => null; c01b(); /// c01b: compile-time er ror 145 c01b() async* => null; c01b(); /// c01b: compile-time er ror
143 c01c() sync* => null; c01c(); /// c01c: compile-time er ror 146 c01c() sync* => null; c01c(); /// c01c: compile-time er ror
144 c02a() async {} c02a(); /// c02a: ok 147 c02a() async {} c02a(); /// c02a: ok
145 c03a() async* {} c03a(); /// c03a: ok 148 c03a() async* {} c03a(); /// c03a: ok
146 c04a() sync* {} c04a(); /// c04a: ok 149 c04a() sync* {} c04a(); /// c04a: ok
147 c04b() sync {} c04b(); /// c04b: compile-time er ror 150 c04b() sync {} c04b(); /// c04b: compile-time er ror
148 c05a() async { await 0; } c05a(); /// c05a: ok 151 c05a() async { await 0; } c05a(); /// c05a: ok
149 c06a() async { await for (var o in []) {} } c06a(); /// c06a: ok 152 c06a() async { await for (var o in st) {} } c06a(); /// c06a: ok
150 c07a() sync* { yield 0; } c07a(); /// c07a: ok 153 c07a() sync* { yield 0; } c07a(); /// c07a: ok
151 c08a() sync* { yield* []; } c08a(); /// c08a: ok 154 c08a() sync* { yield* []; } c08a(); /// c08a: ok
152 c09a() async* { yield 0; } c09a(); /// c09a: ok 155 c09a() async* { yield 0; } c09a(); /// c09a: ok
153 c10a() async* { yield* []; } c10a(); /// c10a: ok 156 c10a() async* { yield* []; } c10a(); /// c10a: ok
154 } 157 }
155 158
156 method2() { 159 method2() {
157 var d01a = () async => null; d01a(); /// d01a: ok 160 var d01a = () async => null; d01a(); /// d01a: ok
158 var d01b = () async* => null; d01b(); /// d01b: compile -time error 161 var d01b = () async* => null; d01b(); /// d01b: compile -time error
159 var d01c = () sync* => null; d01c(); /// d01c: compile -time error 162 var d01c = () sync* => null; d01c(); /// d01c: compile -time error
160 var d02a = () async {}; d02a(); /// d02a: ok 163 var d02a = () async {}; d02a(); /// d02a: ok
161 var d03a = () async* {}; d03a(); /// d03a: ok 164 var d03a = () async* {}; d03a(); /// d03a: ok
162 var d04a = () sync* {}; d04a(); /// d04a: ok 165 var d04a = () sync* {}; d04a(); /// d04a: ok
163 var d04b = () sync {}; d04b(); /// d04b: compile -time error 166 var d04b = () sync {}; d04b(); /// d04b: compile -time error
164 var d05a = () async { await 0; }; d05a(); /// d05a: ok 167 var d05a = () async { await 0; }; d05a(); /// d05a: ok
165 var d06a = () async { await for (var o in []) {} }; d06a(); /// d06a: ok 168 var d06a = () async { await for (var o in st) {} }; d06a(); /// d06a: ok
166 var d07a = () sync* { yield 0; }; d07a(); /// d07a: ok 169 var d07a = () sync* { yield 0; }; d07a(); /// d07a: ok
167 var d08a = () sync* { yield* []; }; d08a(); /// d08a: ok 170 var d08a = () sync* { yield* []; }; d08a(); /// d08a: ok
168 var d08b = () sync* { yield*0+1; }; d08b(); /// d08b: ok 171 var d08b = () sync* { yield*0+1; }; d08b(); /// d08b: ok
169 var d08c = () { yield*0+1; }; d08c(); /// d08c: ok 172 var d08c = () { yield*0+1; }; d08c(); /// d08c: ok
170 var d09a = () async* { yield 0; }; d09a(); /// d09a: ok 173 var d09a = () async* { yield 0; }; d09a(); /// d09a: ok
171 var d10a = () async* { yield* []; }; d10a(); /// d10a: ok 174 var d10a = () async* { yield* []; }; d10a(); /// d10a: ok
172 } 175 }
173 176
174 177
175 void main() { 178 void main() {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 a = c.async; /// b14c: continued 267 a = c.async; /// b14c: continued
265 a = c.async; /// b14d: continued 268 a = c.async; /// b14d: continued
266 c.sync(); /// b15a: continued 269 c.sync(); /// b15a: continued
267 c.sync(); /// b15b: continued 270 c.sync(); /// b15b: continued
268 c.async(); /// b15c: continued 271 c.async(); /// b15c: continued
269 c.async(); /// b15d: continued 272 c.async(); /// b15d: continued
270 273
271 method1(); 274 method1();
272 method2(); 275 method2();
273 } 276 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/async_await_syntax_test.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698