S15.3_A3_T3.js (920B)
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 Since when call is used for Function constructor themself new function instance creates 7 and then first argument(thisArg) should be ignored 8 es5id: 15.3_A3_T3 9 description: First argument is this, and this don`t have needed variable 10 ---*/ 11 12 var f = Function.call(this, "return planet;"); 13 var g = Function.call(this, "return color;"); 14 15 assert.sameValue(f(), undefined, 'f() returns undefined'); 16 17 var planet = "mars"; 18 19 assert.sameValue(f(), "mars", 'f() must return "mars"'); 20 21 try { 22 g(); 23 throw new Test262Error('#3: '); 24 } catch (e) { 25 assert( 26 e instanceof ReferenceError, 27 'The result of evaluating (e instanceof ReferenceError) is expected to be true' 28 ); 29 } 30 31 this.color = "red"; 32 33 assert.sameValue(g(), "red", 'g() must return "red"'); 34 35 reportCompare(0, 0);