michael@0: // Copyright 2009 the Sputnik authors. All rights reserved. michael@0: // This code is governed by the BSD license found in the LICENSE file. michael@0: michael@0: /** michael@0: * Since a function is an object, it might be set to [[Prototype]] property of a new created object through [[Construct]] property michael@0: * michael@0: * @path ch13/13.2/S13.2.2_A1_T1.js michael@0: * @description Declaring a function with "function __func()" michael@0: */ michael@0: michael@0: var __MONSTER="monster"; michael@0: var __PREDATOR="predator"; michael@0: michael@0: function __PROTO(){}; michael@0: michael@0: try{ michael@0: __PROTO.type=__MONSTER; michael@0: } michael@0: catch(e){ michael@0: $ERROR('#0: __PROTO.type=__MONSTER does not lead to throwing exception') michael@0: } michael@0: michael@0: function __FACTORY(){this.name=__PREDATOR}; michael@0: michael@0: __FACTORY.prototype=__PROTO; michael@0: michael@0: var __monster = new __FACTORY(); michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#1 michael@0: if (!(__PROTO.isPrototypeOf(__monster))) { michael@0: $ERROR('#1: __PROTO.isPrototypeOf(__monster) must be true'); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#2 michael@0: if (__monster.type !==__MONSTER) { michael@0: $ERROR('#2: __monster.type ===__MONSTER. Actual: __monster.type ==='+__monster.type); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: