michael@0: load(libdir + "asserts.js"); michael@0: michael@0: var cases = [ michael@0: "{", michael@0: "{ ;", michael@0: "var", michael@0: "var x,", michael@0: "var x =", michael@0: "let", michael@0: "let x,", michael@0: "let x =", michael@0: "const", michael@0: "const x =", michael@0: "const x = 1,", michael@0: "if", michael@0: "if (", michael@0: "if (0) ; else", michael@0: "do", michael@0: "do ;", michael@0: "do ; while", michael@0: "do ; while (", michael@0: "do ; while (1", michael@0: "while", michael@0: "while (", michael@0: "while (1", michael@0: "while (1)", michael@0: "for", michael@0: "for (", michael@0: "for (;", michael@0: "for (;;", michael@0: "for (;;)", michael@0: "for (var", michael@0: "for (x", michael@0: "for (x in", michael@0: "for (x in y", michael@0: "for (x in y)", michael@0: "for (x of", michael@0: "for (x of y", michael@0: "for (x of y)", michael@0: "switch", michael@0: "switch (", michael@0: "switch (x", michael@0: "switch (x)", michael@0: "with", michael@0: "with (", michael@0: "with (x", michael@0: "with (x)", michael@0: "a:", michael@0: "throw", michael@0: "try", michael@0: "try {", michael@0: "try {} catch", michael@0: "try {} catch (", michael@0: "try {} catch (exc", michael@0: "try {} catch (exc if", michael@0: "try {} catch (exc if 1", michael@0: "try {} finally", michael@0: "try {} finally {", michael@0: michael@0: "function", michael@0: "function f", michael@0: "function f(", michael@0: "function f()", michael@0: "function f() {", michael@0: "(function", michael@0: "(function f", michael@0: "(function f(", michael@0: "(function f()", michael@0: michael@0: ]; michael@0: michael@0: for (var s of cases) michael@0: assertThrowsInstanceOf(() => Function(s), SyntaxError); michael@0: