summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_5/misc/line-paragraph-separator-parse-as-lineterminator.js
blob: 8eef6d65813d4ac5f345ef5da649b41fcacc70ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/licenses/publicdomain/
 */

//-----------------------------------------------------------------------------
var BUGNUMBER = 663331;
var summary =
  "U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR must match the " +
  "LineTerminator production when parsing code";

print(BUGNUMBER + ": " + summary);

/**************
 * BEGIN TEST *
 **************/

var hidden = 17;
var assigned;

assigned = 42;
assertEq(eval('"use strict"; var hidden\u2028assigned = 5; typeof hidden'),
         "undefined");
assertEq(assigned, 5);

assigned = 42;
function t1()
{
  assertEq(eval('var hidden\u2028assigned = 5; typeof hidden'), "undefined");
  assertEq(assigned, 5);
}
t1();

assigned = 42;
assertEq(eval('"use strict"; var hidden\u2029assigned = 5; typeof hidden'),
         "undefined");
assertEq(assigned, 5);

assigned = 42;
function t2()
{
  assertEq(eval('var hidden\u2029assigned = 5; typeof hidden'), "undefined");
  assertEq(assigned, 5);
}
t2();

/******************************************************************************/

reportCompare(true, true);

print("All tests passed!");