Debian Codegraph @

js/src/tests/test262/language/statements/function/S13.2.2_A15_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 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_T1
9 description: >
10 Function declared at the end of the program and "obj" property is
11 declared with "var obj = {}"
12 ---*/
13
14 var __obj = new __FACTORY();
15
16 //////////////////////////////////////////////////////////////////////////////
17 //CHECK#1
18 if (typeof obj !== "undefined") {
19 throw new Test262Error('#1: typeof obj === "undefined". Actual: typeof obj ==='+typeof obj);
20 }
21 //
22 //////////////////////////////////////////////////////////////////////////////
23
24 //////////////////////////////////////////////////////////////////////////////
25 //CHECK#2
26 if (__obj.prop !== "A") {
27 throw new Test262Error('#2: __obj.prop === "A". Actual: __obj.prop ==='+__obj.prop);
28 }
29 //
30 //////////////////////////////////////////////////////////////////////////////
31
32 //////////////////////////////////////////////////////////////////////////////
33 //CHECK#3
34 if (__obj.slot.prop !==1) {
35 throw new Test262Error('#3: __obj.slot.prop ===1. Actual: __obj.slot.prop ==='+__obj.slot.prop);
36 }
37 //
38 //////////////////////////////////////////////////////////////////////////////
39
40 function __FACTORY(){
41 this.prop = 1;
42 var obj = {};
43 obj.prop = "A";
44 obj.slot = this;
45 return obj;
46 }
47
48 reportCompare(0, 0);