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

Side by Side Diff: tests/language/infinite_switch_label_test.dart

Issue 14969004: Implement continue for switch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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) 2013, 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 // Test nested switch statement using labels.
6
7 library nested_switch_label;
8
9 import "package:expect/expect.dart";
10
11 void main() {
12 Expect.throws(() => doSwitch(0), (list) {
13 Expect.listEquals([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], list);
14 return true;
15 });
16 Expect.throws(() => doSwitch(2), (list) {
17 Expect.listEquals([2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], list);
18 return true;
19 });
20 }
ngeoffray 2013/05/14 07:08:51 New line.
Johnni Winther 2013/05/17 07:03:04 Done.
21 void doSwitch(int target) {
22 List list = [];
23 switch (target) {
24 l0: case 0:
25 if (list.length > 10) throw list;
26 list.add(0);
27 continue l1;
28 l1: case 1:
29 if (list.length > 10) throw list;
30 list.add(1);
31 continue l0;
32 default:
33 list.add(2);
34 continue l1;
35 }
36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698