1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-26 20:28:49 +08:00

Convert _syntaxError to SyntaxError (eval)

This commit is contained in:
Robert Krimen
2012-10-17 10:27:22 -07:00
parent 32cbffe7b8
commit 474a473e36
4 changed files with 27 additions and 2 deletions

View File

@@ -1797,12 +1797,15 @@ func Test_eval(t *testing.T) {
Terst(t)
test := runTest()
test(`
abc = 1
`)
test(`
eval("abc += 1")
`, "2")
test(`
(function(){
var abc = 11
@@ -1811,6 +1814,22 @@ func Test_eval(t *testing.T) {
})()
`, "12")
test(`abc`, "2")
test(`
var ghi;
(function(){
try {
eval("var prop = \\u2029;");
return false;
} catch (abc) {
ghi = abc.toString()
return abc instanceof SyntaxError;
}
})()
`, "true")
// TODO Make this a sane result
// Lightning bolt, lightning bolt, lightning bolt, ...
test(`ghi`, "SyntaxError: SyntaxError: SyntaxError: Unexpected token ILLEGAL ()")
}
func Test_isNaN(t *testing.T) {