js/src/jit-test/tests/parser/truncation.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:a9c9c5058330
1 load(libdir + "asserts.js");
2
3 var cases = [
4 "{",
5 "{ ;",
6 "var",
7 "var x,",
8 "var x =",
9 "let",
10 "let x,",
11 "let x =",
12 "const",
13 "const x =",
14 "const x = 1,",
15 "if",
16 "if (",
17 "if (0) ; else",
18 "do",
19 "do ;",
20 "do ; while",
21 "do ; while (",
22 "do ; while (1",
23 "while",
24 "while (",
25 "while (1",
26 "while (1)",
27 "for",
28 "for (",
29 "for (;",
30 "for (;;",
31 "for (;;)",
32 "for (var",
33 "for (x",
34 "for (x in",
35 "for (x in y",
36 "for (x in y)",
37 "for (x of",
38 "for (x of y",
39 "for (x of y)",
40 "switch",
41 "switch (",
42 "switch (x",
43 "switch (x)",
44 "with",
45 "with (",
46 "with (x",
47 "with (x)",
48 "a:",
49 "throw",
50 "try",
51 "try {",
52 "try {} catch",
53 "try {} catch (",
54 "try {} catch (exc",
55 "try {} catch (exc if",
56 "try {} catch (exc if 1",
57 "try {} finally",
58 "try {} finally {",
59
60 "function",
61 "function f",
62 "function f(",
63 "function f()",
64 "function f() {",
65 "(function",
66 "(function f",
67 "(function f(",
68 "(function f()",
69
70 ];
71
72 for (var s of cases)
73 assertThrowsInstanceOf(() => Function(s), SyntaxError);
74

mercurial