Debian Codegraph @

js/src/tests/non262/statements/regress-157509.js

raw
1 /* -*- indent-tabs-mode: nil; js-indent-level: 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 UBound = 0;
15 var BUGNUMBER = 157509;
16 var summary = "Testing for SyntaxError on usage of '\\' in identifiers";
17 var TEST_PASSED = 'SyntaxError';
18 var TEST_FAILED = 'Generated an error, but NOT a SyntaxError!';
19 var TEST_FAILED_BADLY = 'Did not generate ANY error!!!';
20 var status = '';
21 var statusitems = [];
22 var actual = '';
23 var actualvalues = [];
24 var expect= '';
25 var expectedvalues = [];
26
27
28 status = inSection(1);
29 expect = TEST_PASSED;
30 actual = TEST_FAILED_BADLY;
31 /*
32 * OK, this should generate a SyntaxError
33 */
34 try
35 {
36 eval('var a\\1 = 0;');
37 }
38 catch(e)
39 {
40 if (e instanceof SyntaxError)
41 actual = TEST_PASSED;
42 else
43 actual = TEST_FAILED;
44 }
45 addThis();
46
47
48
49
50 //-----------------------------------------------------------------------------
51 test();
52 //-----------------------------------------------------------------------------
53
54
55
56 function addThis()
57 {
58 statusitems[UBound] = status;
59 actualvalues[UBound] = actual;
60 expectedvalues[UBound] = expect;
61 UBound++;
62 }
63
64
65 function test()
66 {
67 printBugNumber(BUGNUMBER);
68 printStatus(summary);
69
70 for (var i=0; i<UBound; i++)
71 {
72 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
73 }
74 }