blob: 64f66401a6039189dfec4a43500189c7e4511c47 [file] [log] [blame]
description(
"This test checks the names of all sorts of different functions."
);
document.documentElement.setAttribute("onclick", " return 2; ");
shouldBe("new Function(' return 1; ').toString().replace(/[ \\n]+/g, ' ')", "'function anonymous( ) { return 1; }'");
shouldBe("document.documentElement.onclick.toString().replace(/[ \\n]+/g, ' ')", "'function onclick(event) { return 2; }'");
shouldBe("''.constructor", "String");
function checkConstructorName(name)
{
shouldBe(name + ".toString()", "'function " + name + "() { [native code] }'");
}
checkConstructorName("Boolean");
checkConstructorName("Date");
checkConstructorName("Error");
checkConstructorName("EvalError");
checkConstructorName("Function");
checkConstructorName("Number");
checkConstructorName("Object");
checkConstructorName("RangeError");
checkConstructorName("ReferenceError");
checkConstructorName("RegExp");
checkConstructorName("String");
checkConstructorName("SyntaxError");
checkConstructorName("TypeError");
checkConstructorName("URIError");