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

Side by Side Diff: tests/language/src/ContinueTest.dart

Issue 10248007: test rename overhaul: step 8 - language tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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/language/src/ContextTest.dart ('k') | tests/language/src/CyclicConstructorTest.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) 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 // Dart test for continue in for, do/while and while loops.
5
6 class ContinueTest {
7 static testMain() {
8 int i;
9 int forCounter = 0;
10 for (i = 0; i < 10; i++) {
11 if (i > 3) continue;
12 forCounter++;
13 }
14 Expect.equals(4, forCounter);
15 Expect.equals(10, i);
16
17 i = 0;
18 int doWhileCounter = 0;
19 do {
20 i++;
21 if (i > 3) continue;
22 doWhileCounter++;
23 } while (i < 10);
24 Expect.equals(3, doWhileCounter);
25 Expect.equals(10, i);
26
27 i = 0;
28 int whileCounter = 0;
29 while (i < 10) {
30 i++;
31 if (i > 3) continue;
32 whileCounter++;
33 }
34 Expect.equals(3, whileCounter);
35 Expect.equals(10, i);
36
37 // Use a label to continue to the outer loop.
38 i = 0;
39 L: while (i < 50) {
40 i += 3;
41 while (i < 30) {
42 i += 2;
43 if (i < 10) {
44 continue L;
45 } else {
46 i++;
47 break;
48 }
49 }
50 break;
51 }
52 Expect.equals(11, i);
53
54 // continue without label inside switch continues to innermost loop.
55 do {
56 i = 20;
57 switch (0) {
58 case 0:
59 i = 22;
60 continue;
61 default:
62 i = 25;
63 break;
64 }
65 i = 30;
66 } while (false);
67 Expect.equals(22, i);
68 }
69 }
70
71 main() {
72 ContinueTest.testMain();
73 }
OLDNEW
« no previous file with comments | « tests/language/src/ContextTest.dart ('k') | tests/language/src/CyclicConstructorTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698