Debian Codegraph @

js/src/tests/test262/built-ins/Function/S15.3.5_A2_T2.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: Every function instance has a [[Call]] property
6 es5id: 15.3.5_A2_T2
7 description: >
8 For testing call (new Function("arg1,arg2","var x =arg1;
9 this.y=arg2;return arg1+arg2;"))("1",2)
10 ---*/
11 assert.sameValue(
12 (new Function("arg1,arg2", "var x =arg1; this.y=arg2;return arg1+arg2;"))("1", 2),
13 "12",
14 'new Function("arg1,arg2", "var x =arg1; this.y=arg2;return arg1+arg2;")(1, 2) must return "12"'
15 );
16
17 assert.sameValue(typeof x, "undefined", 'The value of `typeof x` is expected to be "undefined"');
18 assert.sameValue(y, 2, 'The value of y is expected to be 2');
19
20 reportCompare(0, 0);