]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_2/Statements/switch-003.js
2 * File Name: switch-003.js
4 * Description: The switch Statement
6 * Attempt to verify that case statements are evaluated in source order
8 * Author: christine@netscape.com
12 var SECTION
= "switch-003";
13 var VERSION
= "ECMA_2";
14 var TITLE
= "The switch statement";
17 writeHeaderToLog( SECTION
+ " "+ TITLE
);
20 var testcases
= new Array();
22 SwitchTest( "a", "abc" );
23 SwitchTest( "b", "bc" );
24 SwitchTest( "c", "c" );
25 SwitchTest( "d", "*abc" );
26 SwitchTest( "v", "*abc" );
27 SwitchTest( "w", "w*abc" );
28 SwitchTest( "x", "xw*abc" );
29 SwitchTest( "y", "yxw*abc" );
30 SwitchTest( "z", "zyxw*abc" );
31 // SwitchTest( new java.lang.String("z"), "*abc" );
35 function SwitchTest( input
, expect
) {
39 case "z": result
+= "z";
40 case "y": result
+= "y";
41 case "x": result
+= "x";
42 case "w": result
+= "w";
43 default: result
+= "*";
44 case "a": result
+= "a";
45 case "b": result
+= "b";
46 case "c": result
+= "c";
49 testcases
[tc
++] = new TestCase(
51 "switch with no breaks: input is " + input
,