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

Side by Side Diff: frog/tests/leg_only/bailout_on_continue_test.dart

Issue 10536169: Move frog/tests/{leg,leg_only,frog_native} to tests/compiler/. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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 | « frog/tests/leg_only/bailout_on_break_test.dart ('k') | frog/tests/leg_only/bailout_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
(Empty)
1 // Copyright (c) 2012, 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 class A {
6 operator+(arg) => 42;
7 }
8
9 get42() => 42;
10 getNonInt() => new A();
11 use(x) => x;
12
13 void testInWhileLoop() {
14 var c = get42();
15 int index = 0;
16 while (index++ != 2) {
17 var e = getNonInt();
18 Expect.equals(42, e + 2);
19 if (e !== null) continue;
20 while (true) use(e);
21 }
22 // 'c' must have been saved in the environment.
23 Expect.equals(c, 42);
24 }
25
26 void testInNestedWhileLoop() {
27 var c = get42();
28 int index = 0;
29 while (true) {
30 while (index++ != 2) {
31 var e = getNonInt();
32 Expect.equals(42, e + 2);
33 if (e !== null) continue;
34 }
35 // 'c' must have been saved in the environment.
36 Expect.equals(c, 42);
37 if (c == 42) break;
38 }
39 }
40
41 void testInNestedWhileLoop2() {
42 var c = get42();
43 int index = 0;
44 L0: while (index++ != 2) {
45 while (true) {
46 var e = getNonInt();
47 Expect.equals(42, e + 2);
48 if (e !== null) continue L0;
49 while (true) use(e);
50 }
51 }
52 // 'c' must have been saved in the environment.
53 Expect.equals(c, 42);
54 }
55
56 void testInNestedWhileLoop3() {
57 var c = get42();
58 int index = 0;
59 while (index < 2) {
60 while (index < 2) {
61 var e = getNonInt();
62 Expect.equals(42, e + 2);
63 if (e !== null && index++ == 0) continue;
64 // 'c' must have been saved in the environment.
65 Expect.equals(c, 42);
66 while (e === null) use(e);
67 }
68 }
69 }
70
71 void testInDoWhileLoop() {
72 var c = get42();
73 int index = 0;
74 do {
75 var e = getNonInt();
76 Expect.equals(42, e + 2);
77 if (e !== null) continue;
78 while (true) use(e);
79 } while (index++ != 2);
80 // 'c' must have been saved in the environment.
81 Expect.equals(c, 42);
82 }
83
84 void testInForLoop() {
85 var c = get42();
86 for (int i = 0; i < 10; i++) {
87 var e = getNonInt();
88 Expect.equals(42, e + 2);
89 if (e !== null) continue;
90 while (true) use(e);
91 }
92 // 'c' must have been saved in the environment.
93 Expect.equals(c, 42);
94 }
95
96 main() {
97 testInWhileLoop();
98 testInDoWhileLoop();
99 testInForLoop();
100 testInNestedWhileLoop();
101 testInNestedWhileLoop2();
102 testInNestedWhileLoop3();
103 }
OLDNEW
« no previous file with comments | « frog/tests/leg_only/bailout_on_break_test.dart ('k') | frog/tests/leg_only/bailout_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698