js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A1.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     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  * Native ECMAScript objects have an internal property called [[Prototype]]. The value of this property is
     6  * either null or an object and is used for implementing inheritance
     7  *
     8  * @path ch08/8.6/8.6.2/S8.6.2_A1.js
     9  * @description Check [[Prototype]] property of object
    10  */
    12 //////////////////////////////////////////////////////////////////////////////
    13 //CHECK#1
    14 var __obj={};
    15 if (!Object.prototype.isPrototypeOf(__obj)){
    16   $ERROR('#1: Native ECMAScript objects have an internal property called [[Prototype]]. ');
    17 };
    18 //
    19 //////////////////////////////////////////////////////////////////////////////
    21 //Establish proto (base) object
    22 /*function ProtoObj(){
    24 };*/
    25 var protoObj={};
    26 //Establish foo object
    27 function FooObj(){};
    29 //////////////////////////////////////////////////////////////////////////////
    30 //CHECK#2
    31 // Invoke instance of foo object
    32 var obj__= new FooObj;
    34 if (!Object.prototype.isPrototypeOf(obj__)){
    35   $ERROR('#2.1: protoObj={}; function FooObj(){}; var obj__= new FooObj; Object.prototype.isPrototypeOf(obj__) === true. Actual: ' + (Object.prototype.isPrototypeOf(obj__)));
    36 };
    38 if (!FooObj.prototype.isPrototypeOf(obj__)){
    39   $ERROR('#2.2: protoObj={}; function FooObj(){}; var obj__= new FooObj; FooObj.prototype.isPrototypeOf(obj__) === true. Actual: ' + (FooObj.prototype.isPrototypeOf(obj__)));
    40 };
    42 if (protoObj.isPrototypeOf(obj__)){
    43   $ERROR('#2.3: protoObj={}; function FooObj(){}; var obj__= new FooObj; protoObj.isPrototypeOf(obj__) === false. Actual: ' + (protoObj.isPrototypeOf(obj__)));
    44 };
    45 // Establish inheritance from proto object
    46 FooObj.prototype=protoObj;
    48 if (protoObj.isPrototypeOf(obj__)){
    49   $ERROR('#2.4: protoObj={}; function FooObj(){}; var obj__= new FooObj; FooObj.prototype=protoObj; protoObj.isPrototypeOf(obj__) === false. Actual: ' + (protoObj.isPrototypeOf(obj__)));
    50 };
    51 //
    52 //////////////////////////////////////////////////////////////////////////////
    54 //////////////////////////////////////////////////////////////////////////////
    55 //CHECK#3
    57 // Invoke instance of foo object
    58 var __foo=new FooObj;
    60 if (!Object.prototype.isPrototypeOf(__foo)){
    61   $ERROR('#3.1: protoObj={}; function FooObj(){}; var obj__= new FooObj; FooObj.prototype=protoObj; var __foo=new FooObj; Object.prototype.isPrototypeOf(__foo) === true. Actual: ' + (Object.prototype.isPrototypeOf(__foo)));
    62 };
    64 if (!FooObj.prototype.isPrototypeOf(__foo)){
    65   $ERROR('#3.2: protoObj={}; function FooObj(){}; var obj__= new FooObj; FooObj.prototype=protoObj; var __foo=new FooObj; FooObj.prototype.isPrototypeOf(__foo) === true. Actual: ' + (FooObj.prototype.isPrototypeOf(__foo)));
    66 };
    68 if (!protoObj.isPrototypeOf(__foo)){
    69   $ERROR('#3.3: protoObj={}; function FooObj(){}; var obj__= new FooObj; FooObj.prototype=protoObj; var __foo=new FooObj; protoObj.isPrototypeOf(__foo) === true. Actual: ' + (protoObj.isPrototypeOf(__foo)));
    70 };
    71 //
    72 //////////////////////////////////////////////////////////////////////////////

mercurial