Debian Codegraph @

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