blob: 5ed52408f5bc8592a12f2f9c6bd95ae5c9769249 [file] [log] [blame]
function testSyntaxError(script, message) {
var error = null;
try {
eval(script);
} catch (e) {
error = e;
}
if (!error)
throw new Error("Expected syntax error not thrown");
if (String(error) !== message)
throw new Error("Bad error: " + String(error));
}
testSyntaxError(`
class Base {
hello()
{
print("Hello");
}
*ok()
{
super.hello();
}
}
class Hello extends Base {
*gen()
{
super();
}
}
`, `SyntaxError: super is not valid in this context.`);
testSyntaxError(`
function *hello()
{
super.hello();
}
`, `SyntaxError: super is not valid in this context.`);