Chromium Code Reviews| Index: dart/frog/tests/leg_only/src/SwitchTest.dart |
| diff --git a/dart/frog/tests/leg_only/src/SwitchTest.dart b/dart/frog/tests/leg_only/src/SwitchTest.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6277a15b4bad862f0b34b3af5f085b0f8dc51b27 |
| --- /dev/null |
| +++ b/dart/frog/tests/leg_only/src/SwitchTest.dart |
| @@ -0,0 +1,29 @@ |
| +// Copyright (c) 2012, 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. |
| + |
| +switcher(val) { |
| + var x = 0; |
| + switch (val) { |
| + case 1: |
| + x = 100; |
| + break; |
| + case 2: |
| + x = 200; |
| + break; |
| + case 3: |
| + x = 300; |
| + break; |
| + default: |
| + return 400; |
| + break; |
|
Lasse Reichstein Nielsen
2012/03/06 08:57:14
That break should be dead code.
ahe
2012/03/06 09:16:50
I know. I noticed this would cause a crash, so I "
|
| + } |
| + return x; |
| +} |
| + |
|
Lasse Reichstein Nielsen
2012/03/06 08:57:14
Try pushing it a little :)
E.g., something like:
ahe
2012/03/06 09:16:50
Then my code would be untested. I'm not attempting
|
| +main() { |
| + Expect.equals(100, switcher(1)); |
| + Expect.equals(200, switcher(2)); |
| + Expect.equals(300, switcher(3)); |
| + Expect.equals(400, switcher(4)); |
| +} |