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

Unified Diff: tests/language/src/SwitchLabelTest.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/language/src/SwitchFallthruTest.dart ('k') | tests/language/src/SwitchScopeTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/src/SwitchLabelTest.dart
diff --git a/tests/language/src/SwitchLabelTest.dart b/tests/language/src/SwitchLabelTest.dart
deleted file mode 100644
index 56c3d5d1230d78b56c18367de66c21a03693e766..0000000000000000000000000000000000000000
--- a/tests/language/src/SwitchLabelTest.dart
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright (c) 2011, 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 switch statement using labels.
-
-class Switcher {
-
- Switcher() { }
-
- say1 (sound) {
- var x = 0;
- switch (sound) {
- MOO:
- case "moo":
- x = 100;
- break;
- case "woof":
- x = 200;
- continue MOO;
- default:
- x = 300;
- break;
- }
- return x;
- }
-
- say2 (sound) {
- var x = 0;
- switch (sound) {
- WOOF:
- case "woof":
- x = 200;
- break;
- case "moo":
- x = 100;
- continue WOOF;
- default:
- x = 300;
- break;
- }
- return x;
- }
-
- // forward label to outer switch
- say3 (animal, sound) {
- var x = 0;
- switch (animal) {
- case "cow":
- switch (sound) {
- case "moo":
- x = 100; break;
- case "muh":
- x = 200; break;
- default:
- continue NIX_UNDERSTAND;
- }
- break;
- case "dog":
- if (sound == "woof") {
- x = 300;
- } else {
- continue NIX_UNDERSTAND;
- }
- break;
- NIX_UNDERSTAND:
- case "unicorn":
- x = 400;
- break;
- default:
- x = 500;
- break;
- }
- return x;
- }
-}
-
-class SwitchLabelTest {
- static testMain() {
- Switcher s = new Switcher();
- Expect.equals(100, s.say1("moo"));
- Expect.equals(100, s.say1("woof"));
- Expect.equals(300, s.say1("cockadoodledoo"));
-
- Expect.equals(200, s.say2("moo"));
- Expect.equals(200, s.say2("woof"));
- Expect.equals(300, s.say2("")); // Dead unicorn says nothing.
-
- Expect.equals(100, s.say3("cow", "moo"));
- Expect.equals(200, s.say3("cow", "muh"));
- Expect.equals(400, s.say3("cow", "boeh")); // Don't ask.
- Expect.equals(300, s.say3("dog", "woof"));
- Expect.equals(400, s.say3("dog", "boj")); // Ĉu vi parolas Esperanton?
- Expect.equals(400, s.say3("unicorn", "")); // Still dead.
- Expect.equals(500, s.say3("angry bird", "whoooo"));
- }
-}
-
-main() {
- SwitchLabelTest.testMain();
-}
« no previous file with comments | « tests/language/src/SwitchFallthruTest.dart ('k') | tests/language/src/SwitchScopeTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698