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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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 system exception with "try" statement
     6  *
     7  * @path ch12/12.14/S12.14_A3.js
     8  * @description Checking if execution of "catch" catches system exceptions
     9  */
    11 // CHECK#1
    12 try{
    13   y;
    14   $ERROR('#1: "y" lead to throwing exception');
    15 }
    16 catch(e){}
    18 // CHECK#2
    19 var c2=0;
    20 try{
    21   try{
    22     someValue;
    23     $ERROR('#3.1: "someValues" lead to throwing exception');
    24   }
    25   finally{
    26     c2=1;
    27   }
    28 }
    29 catch(e){
    30   if (c2!==1){
    31     $ERROR('#3.2: "finally" block must be evaluated');
    32   }
    33 }
    35 // CHECK#3
    36 var c3=0,x3=0;
    37 try{
    38   x3=someValue;
    39   $ERROR('#3.1: "x3=someValues" lead to throwing exception');
    40 }
    41 catch(err){  	
    42   x3=1;
    43 }
    44 finally{
    45   c3=1;
    46 }
    47 if (x3!==1){
    48   $ERROR('#3.2: "catch" block must be evaluated');
    49 }
    50 if (c3!==1){
    51   $ERROR('#3.3: "finally" block must be evaluated');
    52 }

mercurial