Debian Codegraph @

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

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