js/src/tests/test262/ch12/12.13/S12.13_A2_T6.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  * "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1 evaluates Expression
     6  *
     7  * @path ch12/12.13/S12.13_A2_T6.js
     8  * @description Throwing object
     9  */
    11 var myObj = {p1: 'a', 
    12              p2: 'b', 
    13              p3: 'c',
    14              value: 'myObj_value',
    15              valueOf : function(){return 'obj_valueOf';},
    16              parseInt : function(){return 'obj_parseInt';},
    17              NaN : 'obj_NaN',
    18              Infinity : 'obj_Infinity',
    19              eval     : function(){return 'obj_eval';},
    20              parseFloat : function(){return 'obj_parseFloat';},
    21              isNaN      : function(){return 'obj_isNaN';},
    22              isFinite   : function(){return 'obj_isFinite';},
    23              i:7
    24 }
    26 try{
    27   throw myObj;
    28 }
    29 catch(e){	
    30 // CHECK#1
    31   if (e.p1!=="a") $ERROR('#1: e.p1 === "a". Actual:  e.p1 ==='+ e.p1  );
    32 // CHECK#2
    33   if (e.value!=='myObj_value') $ERROR('#2: e.p1 === \'myObj_value\'. Actual:  e.p1 ==='+ e.p1  );
    34 // CHECK#3
    35   if (e.eval()!=='obj_eval') $ERROR('#3: e.p1 === \'obj_eval\'. Actual:  e.p1 ==='+ e.p1  );
    36 }
    38 // CHECK#4
    39 myObj.i=6
    40 try{
    41   throw myObj;
    42 }
    43 catch(e){}
    44 if (myObj.i!==6) $ERROR('#4: Handling of catch must be correct');

mercurial