On x86 compilers without fastcall, simulate it when invoking traces and un-simulate...
[wine-gecko.git] / js / tests / js1_2 / statements / switch.js
blobb8cefd36f02d02d2f6021f162eb148e118f4b586
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is Mozilla Communicator client code, released
16 * March 31, 1998.
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 1998
21 * the Initial Developer. All Rights Reserved.
23 * Contributor(s):
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 gTestfile = 'switch.js';
41 /**
42 Filename: switch.js
43 Description: 'Tests the switch statement'
45 http://scopus.mcom.com/bugsplat/show_bug.cgi?id=323696
47 Author: Nick Lerissa
48 Date: March 19, 1998
51 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
52 var VERSION = 'no version';
53 var TITLE = 'statements: switch';
54 var BUGNUMBER="323696";
56 startTest();
57 writeHeaderToLog("Executing script: switch.js");
58 writeHeaderToLog( SECTION + " "+ TITLE);
61 var var1 = "match string";
62 var match1 = false;
63 var match2 = false;
64 var match3 = false;
66 switch (var1)
68 case "match string":
69 match1 = true;
70 case "bad string 1":
71 match2 = true;
72 break;
73 case "bad string 2":
74 match3 = true;
77 new TestCase ( SECTION, 'switch statement',
78 true, match1);
80 new TestCase ( SECTION, 'switch statement',
81 true, match2);
83 new TestCase ( SECTION, 'switch statement',
84 false, match3);
86 var var2 = 3;
88 var match1 = false;
89 var match2 = false;
90 var match3 = false;
91 var match4 = false;
92 var match5 = false;
94 switch (var2)
96 case 1:
97 /* switch (var1)
99 case "foo":
100 match1 = true;
101 break;
102 case 3:
103 match2 = true;
104 break;
106 match3 = true;
107 break;
108 case 2:
109 match4 = true;
110 break;
111 case 3:
112 match5 = true;
113 break;
115 new TestCase ( SECTION, 'switch statement',
116 false, match1);
118 new TestCase ( SECTION, 'switch statement',
119 false, match2);
121 new TestCase ( SECTION, 'switch statement',
122 false, match3);
124 new TestCase ( SECTION, 'switch statement',
125 false, match4);
127 new TestCase ( SECTION, 'switch statement',
128 true, match5);
130 test();