Debian Codegraph @

js/src/tests/test262/built-ins/Function/S15.3.5_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: every function instance has a [[Construct]] property
6 es5id: 15.3.5_A3_T1
7 description: As constructor use Function("var x =1; this.y=2;return \"OK\";")
8 ---*/
9
10 var FACTORY = Function("var x =1; this.y=2;return \"OK\";");
11 var obj = new FACTORY;
12
13 assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');
14 assert.sameValue(obj.constructor, FACTORY, 'The value of obj.constructor is expected to equal the value of FACTORY');
15 assert.sameValue(obj.y, 2, 'The value of obj.y is expected to be 2');
16
17 reportCompare(0, 0);