Debian Codegraph @

js/src/tests/test262/language/statements/function/S13.2.2_A4_T1.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_T1
12 description: Declaring a function with "function __FACTORY()"
13 ---*/
14
15 var __CUBE="cube";
16
17 function __FACTORY(){
18 };
19 __FACTORY.prototype={ shape:__CUBE, printShape:function(){return this.shape;} };
20
21 var __device = new __FACTORY();
22
23 //////////////////////////////////////////////////////////////////////////////
24 //CHECK#1
25 if (__device.printShape === undefined) {
26 throw new Test262Error('#1: __device.printShape !== undefined. Actual: __device.printShape ==='+__device.printShape);
27 }
28 //
29 //////////////////////////////////////////////////////////////////////////////
30
31 //////////////////////////////////////////////////////////////////////////////
32 //CHECK#2
33 if (__device.printShape() !== __CUBE) {
34 throw new Test262Error('#2: __device.printShape() === __CUBE. Actual: __device.printShape() ==='+__device.printShape());
35 }
36 //
37 //////////////////////////////////////////////////////////////////////////////
38
39 reportCompare(0, 0);