S15.3.1_A1_T1.js (890B)
1 // Copyright 2009 the Sputnik authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 info: | 6 The function call Function(…) is equivalent to the object creation expression 7 new Function(…) with the same arguments. 8 es5id: 15.3.1_A1_T1 9 description: Create simple functions and check returned values 10 ---*/ 11 12 var f = Function("return arguments[0];"); 13 14 assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true'); 15 assert.sameValue(f(1), 1, 'f(1) must return 1'); 16 17 var g = new Function("return arguments[0];"); 18 19 20 assert(g instanceof Function, 'The result of evaluating (g instanceof Function) is expected to be true'); 21 assert.sameValue(g("A"), "A", 'g("A") must return "A"'); 22 assert.sameValue(g("A"), f("A"), 'g("A") must return the same value returned by f("A")'); 23 24 reportCompare(0, 0);