|
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 * A new native ECMAScript object is created. |
|
7 * Invoke the [[Call]] property of F, providing native ECMAScript object just created as the this value and |
|
8 * providing the argument list passed into [[Construct]] as the argument values |
|
9 * |
|
10 * @path ch13/13.2/S13.2.2_A5_T2.js |
|
11 * @description Declaring a function with "__FACTORY = function(arg1, arg2)" |
|
12 */ |
|
13 |
|
14 __VOLUME=8; |
|
15 __RED="red"; |
|
16 __ID=12342; |
|
17 __TOP=1.1; |
|
18 __BOTTOM=0.0; |
|
19 __LEFT=0.0; |
|
20 |
|
21 |
|
22 __FACTORY = function(arg1, arg2){ |
|
23 this.volume=__VOLUME; |
|
24 color=__RED; |
|
25 this.id=arg1; |
|
26 top=arg2; |
|
27 this.bottom=arguments[3]; |
|
28 left=arguments[4]; |
|
29 }; |
|
30 |
|
31 __device = new __FACTORY(__ID, __TOP, __BOTTOM, __LEFT); |
|
32 |
|
33 ////////////////////////////////////////////////////////////////////////////// |
|
34 //CHECK#1 |
|
35 if (__device.color !== undefined) { |
|
36 $ERROR('#1: __device.color === undefined. Actual: __device.color ==='+__device.color); |
|
37 } |
|
38 // |
|
39 ////////////////////////////////////////////////////////////////////////////// |
|
40 |
|
41 ////////////////////////////////////////////////////////////////////////////// |
|
42 //CHECK#2 |
|
43 if (__device.volume !== __VOLUME) { |
|
44 $ERROR('#2: __device.volume === __VOLUME. Actual: __device.volume ==='+__device.volume); |
|
45 } |
|
46 // |
|
47 ////////////////////////////////////////////////////////////////////////////// |
|
48 |
|
49 ////////////////////////////////////////////////////////////////////////////// |
|
50 //CHECK#3 |
|
51 if (__device.top !== undefined) { |
|
52 $ERROR('#3: __device.top === undefined. Actual: __device.top ==='+__device.top); |
|
53 } |
|
54 // |
|
55 ////////////////////////////////////////////////////////////////////////////// |
|
56 |
|
57 ////////////////////////////////////////////////////////////////////////////// |
|
58 //CHECK#4 |
|
59 if (__device.id !== __ID) { |
|
60 $ERROR('#4: __device.id === __ID. Actual: __device.id ==='+__device.id); |
|
61 } |
|
62 // |
|
63 ////////////////////////////////////////////////////////////////////////////// |
|
64 |
|
65 ////////////////////////////////////////////////////////////////////////////// |
|
66 //CHECK#5 |
|
67 if (__device.left !== undefined) { |
|
68 $ERROR('#5: __device.left === undefined. Actual: __device.left ==='+__device.left); |
|
69 } |
|
70 // |
|
71 ////////////////////////////////////////////////////////////////////////////// |
|
72 |
|
73 ////////////////////////////////////////////////////////////////////////////// |
|
74 //CHECK#6 |
|
75 if (__device.bottom !== __BOTTOM) { |
|
76 $ERROR('#6: __device.bottom === __BOTTOM. Actual: __device.bottom ==='+__device.bottom); |
|
77 } |
|
78 // |
|
79 ////////////////////////////////////////////////////////////////////////////// |
|
80 |