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

Side by Side Diff: frog/tests/leg_only/bailout_on_break_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
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 while (true) {
16 var e = getNonInt();
17 Expect.equals(42, e + 2);
18 if (e !== null) break;
19 while (true) use(e);
20 }
21 // This is what matters: 'c' must have been saved in the
22 // environment.
23 Expect.equals(c, 42);
24 }
25
26 void testInNestedWhileLoop() {
27 var c = get42();
28 while (true) {
29 while (true) {
30 var e = getNonInt();
31 Expect.equals(42, e + 2);
32 if (e !== null) break;
33 }
34 // This is what matters: 'c' must have been saved in the
35 // environment.
36 Expect.equals(c, 42);
37 if (c == 42) break;
38 }
39 }
40
41 void testInNestedWhileLoop2() {
42 var c = get42();
43 L0: while (true) {
44 while (true) {
45 var e = getNonInt();
46 Expect.equals(42, e + 2);
47 if (e !== null) break L0;
48 while (true) use(e);
49 }
50 }
51 // This is what matters: 'c' must have been saved in the
52 // 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) break;
64 // This is what matters: 'c' must have been saved in the
65 // environment.
66 Expect.equals(c, 42);
67 while (e === null) use(e);
68 }
69 }
70 }
71
72 void testInDoWhileLoop() {
73 var c = get42();
74 do {
75 var e = getNonInt();
76 Expect.equals(42, e + 2);
77 if (e !== null) break;
78 while (true) use(e);
79 } while (true);
80 // This is what matters: 'c' must have been saved in the
81 // environment.
82 Expect.equals(c, 42);
83 }
84
85 void testInForLoop() {
86 var c = get42();
87 for (int i = 0; i < 10; i++) {
88 var e = getNonInt();
89 Expect.equals(42, e + 2);
90 if (e !== null) break;
91 while (true) use(e);
92 }
93 // This is what matters: 'c' must have been saved in the
94 // environment.
95 Expect.equals(c, 42);
96 }
97
98 void testLabeledIf() {
99 var c = get42();
100 L1: if (c == 42) {
101 var e = getNonInt();
102 Expect.equals(42, e + 2);
103 if (e === null) break L1;
104 // This is what matters: 'c' must have been saved in the
105 // environment.
106 Expect.equals(c, 42);
107 while (e === null) use(e);
108 }
109 Expect.equals(c, 42);
110 }
111
112 void testLabeledIf2() {
113 var c = get42();
114 L1: if (c == 42) {
115 var e = getNonInt();
116 Expect.equals(42, e + 2);
117 if (e === null) break L1;
118 Expect.equals(42, e + 1);
119 while (e === null) use(e);
120 }
121 Expect.equals(42, c);
122 }
123
124 main() {
125 testInWhileLoop();
126 testInDoWhileLoop();
127 testInForLoop();
128 testInNestedWhileLoop();
129 testInNestedWhileLoop2();
130 testInNestedWhileLoop3();
131 testLabeledIf();
132 testLabeledIf2();
133 }
OLDNEW
« no previous file with comments | « frog/tests/leg_only/bailout_aborting_if_test.dart ('k') | frog/tests/leg_only/bailout_on_continue_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698