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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/parser/truncation.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,74 @@
     1.4 +load(libdir + "asserts.js");
     1.5 +
     1.6 +var cases = [
     1.7 +    "{",
     1.8 +    "{ ;",
     1.9 +    "var",
    1.10 +    "var x,",
    1.11 +    "var x =",
    1.12 +    "let",
    1.13 +    "let x,",
    1.14 +    "let x =",
    1.15 +    "const",
    1.16 +    "const x =",
    1.17 +    "const x = 1,",
    1.18 +    "if",
    1.19 +    "if (",
    1.20 +    "if (0) ; else",
    1.21 +    "do",
    1.22 +    "do ;",
    1.23 +    "do ; while",
    1.24 +    "do ; while (",
    1.25 +    "do ; while (1",
    1.26 +    "while",
    1.27 +    "while (",
    1.28 +    "while (1",
    1.29 +    "while (1)",
    1.30 +    "for",
    1.31 +    "for (",
    1.32 +    "for (;",
    1.33 +    "for (;;",
    1.34 +    "for (;;)",
    1.35 +    "for (var",
    1.36 +    "for (x",
    1.37 +    "for (x in",
    1.38 +    "for (x in y",
    1.39 +    "for (x in y)",
    1.40 +    "for (x of",
    1.41 +    "for (x of y",
    1.42 +    "for (x of y)",
    1.43 +    "switch",
    1.44 +    "switch (",
    1.45 +    "switch (x",
    1.46 +    "switch (x)",
    1.47 +    "with",
    1.48 +    "with (",
    1.49 +    "with (x",
    1.50 +    "with (x)",
    1.51 +    "a:",
    1.52 +    "throw",
    1.53 +    "try",
    1.54 +    "try {",
    1.55 +    "try {} catch",
    1.56 +    "try {} catch (",
    1.57 +    "try {} catch (exc",
    1.58 +    "try {} catch (exc if",
    1.59 +    "try {} catch (exc if 1",
    1.60 +    "try {} finally",
    1.61 +    "try {} finally {",
    1.62 +
    1.63 +    "function",
    1.64 +    "function f",
    1.65 +    "function f(",
    1.66 +    "function f()",
    1.67 +    "function f() {",
    1.68 +    "(function",
    1.69 +    "(function f",
    1.70 +    "(function f(",
    1.71 +    "(function f()",
    1.72 +
    1.73 +];
    1.74 +
    1.75 +for (var s of cases)
    1.76 +    assertThrowsInstanceOf(() => Function(s), SyntaxError);
    1.77 +

mercurial