js/src/tests/test262/ch13/13.2/S13.2.2_A2.js

branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
equal deleted inserted replaced
-1:000000000000 0:80a830fe0132
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 * Since a function is an object, it might be set to [[Prototype]] property of a new created object through [[Construct]] property,
6 * but [[call]] property must fail with TypeError error
7 *
8 * @path ch13/13.2/S13.2.2_A2.js
9 * @description Trying to [[call]] this function
10 */
11
12 var __PLANT="flower";
13 var __ROSE="rose";
14
15 function __PROTO(){};
16
17 try{
18 __PROTO.type=__PLANT;
19 }
20 catch(e){
21 $ERROR('#0: __PROTO.type=__PLANT does not lead to throwing exception')
22 }
23
24 function __FACTORY(){this.name=__ROSE};
25
26 __FACTORY.prototype=__PROTO;
27
28 var __rose = new __FACTORY();
29
30 //////////////////////////////////////////////////////////////////////////////
31 //CHECK#1
32 try{
33 __rose();
34 $ERROR('#1: __rose() lead to throwing exception');
35 } catch(e){
36 if (!(e instanceof TypeError)) {
37 $ERROR('#2: Exception Type is TypeError. Actual: exception ==='+e);
38 }
39 }
40 //
41 //////////////////////////////////////////////////////////////////////////////
42

mercurial