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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/test262/ch12/12.14/S12.14_A3.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,53 @@
     1.4 +// Copyright 2009 the Sputnik authors.  All rights reserved.
     1.5 +// This code is governed by the BSD license found in the LICENSE file.
     1.6 +
     1.7 +/**
     1.8 + * Catching system exception with "try" statement
     1.9 + *
    1.10 + * @path ch12/12.14/S12.14_A3.js
    1.11 + * @description Checking if execution of "catch" catches system exceptions
    1.12 + */
    1.13 +
    1.14 +// CHECK#1
    1.15 +try{
    1.16 +  y;
    1.17 +  $ERROR('#1: "y" lead to throwing exception');
    1.18 +}
    1.19 +catch(e){}
    1.20 +
    1.21 +// CHECK#2
    1.22 +var c2=0;
    1.23 +try{
    1.24 +  try{
    1.25 +    someValue;
    1.26 +    $ERROR('#3.1: "someValues" lead to throwing exception');
    1.27 +  }
    1.28 +  finally{
    1.29 +    c2=1;
    1.30 +  }
    1.31 +}
    1.32 +catch(e){
    1.33 +  if (c2!==1){
    1.34 +    $ERROR('#3.2: "finally" block must be evaluated');
    1.35 +  }
    1.36 +}
    1.37 +
    1.38 +// CHECK#3
    1.39 +var c3=0,x3=0;
    1.40 +try{
    1.41 +  x3=someValue;
    1.42 +  $ERROR('#3.1: "x3=someValues" lead to throwing exception');
    1.43 +}
    1.44 +catch(err){  	
    1.45 +  x3=1;
    1.46 +}
    1.47 +finally{
    1.48 +  c3=1;
    1.49 +}
    1.50 +if (x3!==1){
    1.51 +  $ERROR('#3.2: "catch" block must be evaluated');
    1.52 +}
    1.53 +if (c3!==1){
    1.54 +  $ERROR('#3.3: "finally" block must be evaluated');
    1.55 +}
    1.56 +

mercurial