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