blob: 5a9e0638f62626f47ffcf6b64d5b5c24be8f44c1 [file] [log] [blame]
#!foo
function shouldNotThrow(script) {
eval(script);
}
function shouldThrowSyntaxError(script) {
let error;
try {
eval(script);
} catch (e) {
error = e;
}
if (!(error instanceof SyntaxError))
throw new Error('Expected SyntaxError!');
}
shouldNotThrow('#!foo');
shouldThrowSyntaxError(' #!foo');
shouldThrowSyntaxError('\n#!foo');
shouldThrowSyntaxError('Function("#!foo")');