Debian Codegraph @

rhino/testsrc/tests/js1_5/Regress/regress-275378.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 var gTestfile = 'regress-275378.js';
7 //-----------------------------------------------------------------------------
8 // testcase by Martin Zvieger <[email protected]>
9 // if fails, will fail to run in browser due to syntax error
10 var BUGNUMBER = 275378;
11 var summary = 'Literal RegExp in case block should not give syntax error';
12 var actual = '';
13 var expect = '';
14
15 var status;
16
17 printBugNumber(BUGNUMBER);
18 printStatus (summary);
19
20
21 var tmpString= "XYZ";
22 // works
23 /ABC/.test(tmpString);
24 var tmpVal= 1;
25 if (tmpVal == 1)
26 {
27 // works
28 /ABC/.test(tmpString);
29 }
30 switch(tmpVal)
31 {
32 case 1:
33 {
34 // works
35 /ABC/.test(tmpString);
36 }
37 break;
38 }
39 switch(tmpVal)
40 {
41 case 1:
42 // fails with syntax error
43 /ABC/.test(tmpString);
44 break;
45 }
46
47 expect = actual = 'no error';
48 reportCompare(expect, actual, status);