Debian Codegraph @

rhino/testsrc/tests/ecma_3/Statements/regress-157509.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 /*
7 *
8 * Date: 15 July 2002
9 * SUMMARY: Testing for SyntaxError on usage of '\' in identifiers
10 * See http://bugzilla.mozilla.org/show_bug.cgi?id=157509
11 *
12 */
13 //-----------------------------------------------------------------------------
14 var gTestfile = 'regress-157509.js';
15 var UBound = 0;
16 var BUGNUMBER = 157509;
17 var summary = "Testing for SyntaxError on usage of '\\' in identifiers";
18 var TEST_PASSED = 'SyntaxError';
19 var TEST_FAILED = 'Generated an error, but NOT a SyntaxError!';
20 var TEST_FAILED_BADLY = 'Did not generate ANY error!!!';
21 var status = '';
22 var statusitems = [];
23 var actual = '';
24 var actualvalues = [];
25 var expect= '';
26 var expectedvalues = [];
27
28
29 status = inSection(1);
30 expect = TEST_PASSED;
31 actual = TEST_FAILED_BADLY;
32 /*
33 * OK, this should generate a SyntaxError
34 */
35 try
36 {
37 eval('var a\\1 = 0;');
38 }
39 catch(e)
40 {
41 if (e instanceof SyntaxError)
42 actual = TEST_PASSED;
43 else
44 actual = TEST_FAILED;
45 }
46 addThis();
47
48
49
50
51 //-----------------------------------------------------------------------------
52 test();
53 //-----------------------------------------------------------------------------
54
55
56
57 function addThis()
58 {
59 statusitems[UBound] = status;
60 actualvalues[UBound] = actual;
61 expectedvalues[UBound] = expect;
62 UBound++;
63 }
64
65
66 function test()
67 {
68 enterFunc('test');
69 printBugNumber(BUGNUMBER);
70 printStatus(summary);
71
72 for (var i=0; i<UBound; i++)
73 {
74 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
75 }
76
77 exitFunc ('test');
78 }