| Index: tests/language/infinite_switch_label_test.dart
|
| diff --git a/tests/language/infinite_switch_label_test.dart b/tests/language/infinite_switch_label_test.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9a89b91e0533492f316e81c67319e8b1d41fff95
|
| --- /dev/null
|
| +++ b/tests/language/infinite_switch_label_test.dart
|
| @@ -0,0 +1,37 @@
|
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +// Test nested switch statement using labels.
|
| +
|
| +library nested_switch_label;
|
| +
|
| +import "package:expect/expect.dart";
|
| +
|
| +void main() {
|
| + Expect.throws(() => doSwitch(0), (list) {
|
| + Expect.listEquals([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], list);
|
| + return true;
|
| + });
|
| + Expect.throws(() => doSwitch(2), (list) {
|
| + Expect.listEquals([2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], list);
|
| + return true;
|
| + });
|
| +}
|
| +
|
| +void doSwitch(int target) {
|
| + List list = [];
|
| + switch (target) {
|
| + l0: case 0:
|
| + if (list.length > 10) throw list;
|
| + list.add(0);
|
| + continue l1;
|
| + l1: case 1:
|
| + if (list.length > 10) throw list;
|
| + list.add(1);
|
| + continue l0;
|
| + default:
|
| + list.add(2);
|
| + continue l1;
|
| + }
|
| +}
|
|
|