Debian Codegraph @

js/src/tests/non262/syntax/line-number-maintenance-for-identifier-containing-escape-terminated-by-unicode-separator.js

raw
1 /*
2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/licenses/publicdomain/
4 */
5
6 //-----------------------------------------------------------------------------
7 var BUGNUMBER = 9999999;
8 var summary =
9 "Properly maintain the line number when tokenizing identifiers that " +
10 "contain Unicode escapes *and* are terminated by U+2028 LINE SEPARATOR " +
11 "or U+2029 PARAGRAPH SEPARATOR";
12
13 print(BUGNUMBER + ": " + summary);
14
15 /**************
16 * BEGIN TEST *
17 **************/
18
19 var code = "var a\u0062c = [];\n"; // line 1
20
21 for (var i = 0; i < 100; i++)
22 code += "a\\u0062c\u2028a\\u0062c\u2029"; // lines 2..2+200-1
23
24 code += "@"; // line 2+200
25
26 try
27 {
28 eval(code);
29 throw new Error("didn't throw");
30 }
31 catch (e)
32 {
33 assertEq(e.lineNumber, 2 + 200);
34 }
35
36 /******************************************************************************/
37
38 if (typeof reportCompare === "function")
39 reportCompare(true, true);
40
41 print("Tests complete");