S15.3.4.2_A1_T1.js contains the following:
11 f = function(x) {
12 return x*x;
13 }
14
15 //CHECK#1
16 if (eval(f.toString())(10) !== f(10)) {
17 $ERROR('#1: An implementation-dependent representation of the function is returned. This representation has the syntax of a FunctionDeclaration');
18 }
This test case is *almost* valid. The only issue with it is the assertion on line 16 which assumes the return value of 'eval("f = function(x) {return x*x;}")' (or whatever implementation dependent representation of 'f' the interpreter comes up) is in fact something functionally equivalent to the original 'f'. By 15.1.2.1 (eval function) and chapter 14, the return value of eval here is in fact 'undefined' which invalidates the test.
Haven't thoroughly checked this, but seems like a simple fix could be:
16 if (eval(f.toString() + "(10);") !== f(10)) {
Better yet would be to simply verify that f.toString() matches a very generic RegExp that has the pattern of a FunctionDeclaration.
Looks like this was fixed in Hg's revision 99. Verifying now...
Doesn't look the change:
f = function(x) ...
to:
var f = function(x) ...
actually fixed the underlying problem - running eval on a function expression returns 'undefined'.
Fixed at http://hg.ecmascript.org/tests/test262/rev/71c63c10dcd3