S15.3_A3_T5.js (834B)
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_T5 9 description: > 10 First argument is this, and this don`t have needed variable. 11 Function return this.var_name 12 ---*/ 13 14 var f = Function.call(this, "return this.planet;"); 15 var g = Function.call(this, "return this.color;"); 16 17 assert.sameValue(f(), undefined, 'f() returns undefined'); 18 19 var planet = "mars"; 20 21 assert.sameValue(f(), "mars", 'f() must return "mars"'); 22 assert.sameValue(g(), undefined, 'g() returns undefined'); 23 24 this.color = "red"; 25 26 assert.sameValue(g(), "red", 'g() must return "red"'); 27 28 reportCompare(0, 0);