Debian Codegraph @

js/src/tests/test262/language/statements/function/S13.2.2_A6_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 When the [[Construct]] property for a Function object F is called:
7 A new native ECMAScript object is created.
8 Invoke the [[Call]] property of F, providing just created native ECMAScript object as the this value and providing the argument
9 list passed into [[Construct]] as the argument values.
10 If Type( [[Call]] returned) is not Object then return passed as this into [[Call]] object
11 es5id: 13.2.2_A6_T1
12 description: Declaring a function with "__func = function(arg)"
13 ---*/
14
15 var __FOO, __BAR, __func, __obj;
16
17 __FOO="fooValue";
18 __BAR="barValue";
19
20 __func = function(arg){
21 this.foo=arg;
22 return 0;
23 this.bar=arguments[1];
24 };
25
26 __obj = new __func(__FOO, __BAR);
27
28 //////////////////////////////////////////////////////////////////////////////
29 //CHECK#1
30 if (__obj.foo!==__FOO) {
31 throw new Test262Error('#1: __obj.foo === __FOO. Actual: __obj.foo==='+__obj.foo);
32 }
33 //
34 //////////////////////////////////////////////////////////////////////////////
35
36 //////////////////////////////////////////////////////////////////////////////
37 //CHECK#2
38 if (__obj.bar!==undefined) {
39 throw new Test262Error('#2: __obj.bar === undefined. Actual: __obj.bar==='+__obj.bar);
40 }
41 //
42 //////////////////////////////////////////////////////////////////////////////
43
44 reportCompare(0, 0);