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

Unified Diff: frog/tests/leg_only/switch_test.dart

Issue 10536169: Move frog/tests/{leg,leg_only,frog_native} to tests/compiler/. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: frog/tests/leg_only/switch_test.dart
===================================================================
--- frog/tests/leg_only/switch_test.dart (revision 8644)
+++ frog/tests/leg_only/switch_test.dart (working copy)
@@ -1,83 +0,0 @@
-// 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; // Intentional dead code (regression test for crash).
- }
- return x;
-}
-
-
-// Check unambiguated grammar allowing multiple lables per case/default.
-switcher2(val) {
- var x = 0;
- switch (val) {
- foo:
- bar:
- case 1:
- baz:
- case 2:
- fez: {
- x = 100;
- break fez;
- }
- break;
- hest:
- fisk:
- case 3:
- case 4:
- svin:
- default:
- barber: {
- if (val > 2) {
- x = 200;
- break;
- } else {
- // Enable when continue to switch-case is implemented.
- continue hest; /// 03: compile-time error
- }
- }
- }
- return x;
-}
-
-
-badswitches(val) {
- // Test some badly formed switch bodies.
- // 01 - a label/statement without a following case/default.
- // 02 - a label without a following case/default or statement.
- switch (val) {
- foo: break; /// 01: compile-time error
- case 2: /// 02: compile-time error
- foo: /// 02: continued
- }
-}
-
-main() {
- Expect.equals(100, switcher(1));
- Expect.equals(200, switcher(2));
- Expect.equals(300, switcher(3));
- Expect.equals(400, switcher(4));
-
- Expect.equals(100, switcher2(1));
- Expect.equals(100, switcher2(2));
- Expect.equals(200, switcher2(3));
- Expect.equals(200, switcher2(4));
- Expect.equals(200, switcher2(5));
-
- badswitches(42);
-}
« no previous file with comments | « frog/tests/leg_only/super_constructor2_test.dart ('k') | frog/tests/leg_only/this_phi_elimination_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698