Wed, 31 Dec 2014 07:53:36 +0100
Correct small whitespace inconsistency, lost while renaming variables.
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
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 */
12 var __PLANT="flower";
13 var __ROSE="rose";
15 function __PROTO(){};
17 try{
18 __PROTO.type=__PLANT;
19 }
20 catch(e){
21 $ERROR('#0: __PROTO.type=__PLANT does not lead to throwing exception')
22 }
24 function __FACTORY(){this.name=__ROSE};
26 __FACTORY.prototype=__PROTO;
28 var __rose = new __FACTORY();
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 //////////////////////////////////////////////////////////////////////////////