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

Side by Side Diff: tests/kernel/unsorted/breakable_statement_test.dart

Issue 2451623006: Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork." (Closed)
Patch Set: Fix Created 4 years, 1 month 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) 2016, 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 import 'expect.dart';
6
7 testFor() {
8 int current;
9 for (int i = 0; i < 100; i++) {
10 current = i;
11 if (i > 41) break;
12 }
13 Expect.isTrue(current == 42);
14 }
15
16 testWhile() {
17 int i = 0;
18 while (i < 100) {
19 if (++i > 41) break;
20 }
21 Expect.isTrue(i == 42);
22 }
23
24 testDoWhile() {
25 int i = 0;
26 do {
27 if (++i > 41) break;
28 } while (i < 100);
29 Expect.isTrue(i == 42);
30 }
31
32 testLabledBreakOutermost() {
33 int i = 0;
34 outer: {
35 middle: {
36 while (i < 100) {
37 if (++i > 41) break outer;
38 }
39 i++;
40 }
41 i++;
42 }
43 Expect.isTrue(i == 42);
44 }
45
46 testLabledBreakMiddle() {
47 int i = 0;
48 outer: {
49 middle: {
50 while (i < 100) {
51 if (++i > 41) break middle;
52 }
53 i++;
54 }
55 i++;
56 }
57 Expect.isTrue(i == 43);
58 }
59
60 testLabledBreakInner() {
61 int i = 0;
62 outer: {
63 middle: {
64 while (i < 100) {
65 if (++i > 41) break;
66 }
67 i++;
68 }
69 i++;
70 }
71 Expect.isTrue(i == 44);
72 }
73
74 main() {
75 testFor();
76 testWhile();
77 testDoWhile();
78 testLabledBreakOutermost();
79 testLabledBreakMiddle();
80 testLabledBreakInner();
81 }
OLDNEW
« no previous file with comments | « tests/kernel/unsorted/block_scope_test.dart ('k') | tests/kernel/unsorted/closures_regression_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698