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