Debian Codegraph @

js/src/tests/test262/built-ins/Function/S15.3_A3_T1.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_T1
9 description: First argument is object
10 ---*/
11
12 var f = Function.call(mars, "return name;");
13 var mars = {
14 name: "mars",
15 color: "red",
16 number: 4
17 };
18
19 var f = Function.call(mars, "this.godname=\"ares\"; return this.color;");
20
21 var about_mars = f();
22
23 assert.sameValue(about_mars, undefined);
24
25 if (this.godname !== "ares" && mars.godname === undefined) {
26 throw new Test262Error('#3: When applied to the Function object itself, thisArg should be ignored');
27 }
28
29 reportCompare(0, 0);