js/src/tests/test262/ch12/12.14/S12.14_A18_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  * Catching objects with try/catch/finally statement
     6  *
     7  * @path ch12/12.14/S12.14_A18_T6.js
     8  * @description Catching 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.value===\'myObj_value\'. Actual:  e.value==='+ e.value );
    34 // CHECK#3
    35   if (e.eval()!=='obj_eval') $ERROR('#3: e.eval()===\'obj_eval\'. Actual:  e.eval()==='+ e.eval() );
    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');
    46 // CHECK#5
    47 myObj.i=6;
    48 try{
    49   throw myObj;
    50 }
    51 catch(e){
    52   e.i=10;
    53 }
    54 if (myObj.i!==10) $ERROR('#5: Handling of catch must be correct');

mercurial