2 "This test checks the names of all sorts of different functions."
5 document
.documentElement
.setAttribute("onclick", " return 2; ");
7 shouldBe("new Function(' return 1; ').toString().replace(/[ \\n]+/g, ' ')", "'function anonymous() { return 1; }'");
8 shouldBe("document.documentElement.onclick.toString().replace(/[ \\n]+/g, ' ')", "'function onclick(event) { return 2; }'");
10 shouldBe("''.constructor", "String");
12 function checkConstructorName(name
)
14 shouldBe(name
+ ".toString()", "'function " + name
+ "() {\\n [native code]\\n}'");
17 checkConstructorName("Boolean");
18 checkConstructorName("Date");
19 checkConstructorName("Error");
20 checkConstructorName("EvalError");
21 checkConstructorName("Function");
22 checkConstructorName("Number");
23 checkConstructorName("Object");
24 checkConstructorName("RangeError");
25 checkConstructorName("ReferenceError");
26 checkConstructorName("RegExp");
27 checkConstructorName("String");
28 checkConstructorName("SyntaxError");
29 checkConstructorName("TypeError");
30 checkConstructorName("URIError");