Debian Codegraph @

js/src/tests/test262/language/statements/function/S13.2.2_A4_T2.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 A new native ECMAScript object is created.
8 Gets the value of the [[Prototype]] property of the F(Denote it PROTO_VAL).
9 If PROTO_VAL is an object, sets the [[Prototype]] property of native ECMAScript object just created
10 to the PROTO_VAL
11 es5id: 13.2.2_A4_T2
12 description: Declaring a function with "__FACTORY = function()"
13 ---*/
14
15 var __CUBE, __FACTORY, __device;
16
17 __CUBE="cube";
18
19 __FACTORY = function(){};
20
21 __FACTORY.prototype={ shape:__CUBE, printShape:function(){return this.shape;} };
22
23 __device = new __FACTORY();
24
25 //////////////////////////////////////////////////////////////////////////////
26 //CHECK#1
27 if (__device.printShape === undefined) {
28 throw new Test262Error('#1: __device.printShape !== undefined. Actual: __device.printShape ==='+__device.printShape);
29 }
30 //
31 //////////////////////////////////////////////////////////////////////////////
32
33 //////////////////////////////////////////////////////////////////////////////
34 //CHECK#2
35 if (__device.printShape() !== __CUBE) {
36 throw new Test262Error('#2: __device.printShape() === __CUBE. Actual: __device.printShape() ==='+__device.printShape());
37 }
38 //
39 //////////////////////////////////////////////////////////////////////////////
40
41 reportCompare(0, 0);