Debian Codegraph @

js/src/tests/test262/language/statements/function/S13.2.2_A15_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: |
6 When the [[Construct]] property for a Function object F is called,
7 and the object created in the function is returned, the object (declared with "this" within a function) will be strong and healthy
8 es5id: 13.2.2_A15_T2
9 description: >
10 Function declared at the end of the program and "obj" property is
11 declared with "obj = {}"
12 ---*/
13
14 var obj;
15
16 var __obj = new __FACTORY();
17
18 //////////////////////////////////////////////////////////////////////////////
19 //CHECK#1
20 if (obj.prop !== "A") {
21 throw new Test262Error('#1: obj.prop === "A". Actual: obj.prop ==='+obj.prop);
22 }
23 //
24 //////////////////////////////////////////////////////////////////////////////
25
26 //////////////////////////////////////////////////////////////////////////////
27 //CHECK#2
28 if (__obj.prop !== "A") {
29 throw new Test262Error('#2: __obj.prop === "A". Actual: __obj.prop ==='+__obj.prop);
30 }
31 //
32 //////////////////////////////////////////////////////////////////////////////
33
34 //////////////////////////////////////////////////////////////////////////////
35 //CHECK#3
36 if (__obj.slot.prop !==1) {
37 throw new Test262Error('#3: __obj.slot.prop === 1. Actual: __obj.slot.prop ==='+__obj.slot.prop);
38 }
39 //
40 //////////////////////////////////////////////////////////////////////////////
41
42 function __FACTORY(){
43 this.prop = 1;
44 obj = {};
45 obj.prop = "A";
46 obj.slot = this;
47 return obj;
48 }
49
50 reportCompare(0, 0);