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

Side by Side Diff: frog/tests/await/src/WhileLoopWithBreakTest.dart

Issue 10250002: test rename overhaul: step 5 - frog and leg tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Await within a loop with a break statement.
6
7 #import("await_test_helper.dart");
8
9 main() {
10 var x = 0;
11 while (x < 3) {
12 final f = futureOf(1);
13 final t = await f;
14 if (x == 2) {
15 break;
16 }
17 x += t;
18 }
19 Expect.equals(x, 2);
20 }
21
22 // This is roughly equivalent to:
23 // main() {
24 // final _ret = new Completer();
25 // var x = 0;
26 // _after_loop_1() {
27 // Expect.equals(x, 2);
28 // _ret.complete(null);
29 // }
30 // _loop_1() {
31 // while (x < 3) {
32 // final f = futureOf(1);
33 // f.then((t) {
34 // if (x == 2) {
35 // _after_loop_1();
36 // return;
37 // }
38 // x += t;
39 // _loop_1();
40 // });
41 // Futures.propagateError(f, _ret);
42 // return;
43 // }
44 // _after_loop_1();
45 // }();
46 // return _ret;
47 // }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698