js/src/tests/test262/ch12/12.14/S12.14_A8.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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  * "try" with "catch" or "finally" statement within/without an "if" statement
     6  *
     7  * @path ch12/12.14/S12.14_A8.js
     8  * @description Throwing exception within an "if" statement
     9  */
    11 // CHECK#1
    12 var c1=1;
    13 try{
    14   if(c1===1){
    15     throw "ex1";
    16     $ERROR('#1.1: throw "ex1" lead to throwing exception');
    17   }
    18   $ERROR('#1.2: throw "ex1" inside the "if" statement lead to throwing exception');
    19 }
    20 catch(er1){	
    21   if (er1!=="ex1") $ERROR('#1.3: Exception ==="ex1". Actual:  Exception ==='+er1);
    22 }
    24 // CHECK#2
    25 var c2=1;
    26 if(c2===1){
    27   try{
    28     throw "ex1";
    29     $ERROR('#2.1: throw "ex1" lead to throwing exception');
    30   }
    31   catch(er1){
    32     if(er1!="ex1") $ERROR('#2.2: Exception ==="ex1". Actual:  Exception ==='+er1);
    33   }
    34 }

mercurial