Debian Codegraph @

js/src/tests/test262/built-ins/Function/S15.3_A3_T6.js

raw
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_T6
9 description: >
10 First argument is this, and this have needed variable. Function
11 return this.var_name
12 ---*/
13
14 var f = Function.call(this, "return this.planet;");
15
16 assert.sameValue(f(), undefined, 'f() returns undefined');
17
18 var planet = "mars";
19
20 assert.sameValue(f(), "mars", 'f() must return "mars"');
21
22 reportCompare(0, 0);