js/src/tests/test262/ch12/12.14/S12.14_A7_T1.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_A7_T1.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,138 @@
     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 + * Evaluating the nested productions TryStatement
     1.9 + *
    1.10 + * @path ch12/12.14/S12.14_A7_T1.js
    1.11 + * @description Checking if the production of nested TryStatement statements evaluates correct
    1.12 + */
    1.13 +
    1.14 +// CHECK#1
    1.15 +try{
    1.16 +  try{
    1.17 +    throw "ex2";
    1.18 +  }
    1.19 +  catch(er2){
    1.20 +    if (er2!=="ex2")
    1.21 +      $ERROR('#1.1: Exception === "ex2". Actual:  Exception ==='+ e  );
    1.22 +      throw "ex1";
    1.23 +    }
    1.24 +  }
    1.25 +  catch(er1){
    1.26 +    if (er1!=="ex1") $ERROR('#1.2: Exception === "ex1". Actual: '+er1);
    1.27 +    if (er1==="ex2") $ERROR('#1.3: Exception !== "ex2". Actual: catch previous embedded exception');
    1.28 +}
    1.29 +
    1.30 +// CHECK#2
    1.31 +try{
    1.32 +  throw "ex1";
    1.33 +}
    1.34 +catch(er1){
    1.35 +  try{
    1.36 +    throw "ex2";
    1.37 +  }
    1.38 +  catch(er1){
    1.39 +    if (er1==="ex1") $ERROR('#2.1: Exception !== "ex1". Actual: catch previous catching exception');
    1.40 +    if (er1!=="ex2") $ERROR('#2.2: Exception === "ex2". Actual:  Exception ==='+ er1  );
    1.41 +  }
    1.42 +  if (er1!=="ex1") $ERROR('#2.3: Exception === "ex1". Actual:  Exception ==='+ er1  );
    1.43 +  if (er1==="ex2") $ERROR('#2.4: Exception !== "ex2". Actual: catch previous catching exception');
    1.44 +}
    1.45 +
    1.46 +// CHECK#3
    1.47 +try{
    1.48 +  throw "ex1";
    1.49 +}
    1.50 +catch(er1){
    1.51 +  if (er1!=="ex1") $ERROR('#3.1: Exception ==="ex1". Actual:  Exception ==='+ er1  );
    1.52 +}
    1.53 +finally{
    1.54 +  try{
    1.55 +    throw "ex2";
    1.56 +  }
    1.57 +  catch(er1){
    1.58 +    if (er1==="ex1") $ERROR('#3.2: Exception !=="ex1". Actual: catch previous embedded exception');
    1.59 +    if (er1!=="ex2") $ERROR('#3.3: Exception ==="ex2". Actual:  Exception ==='+ er1  );
    1.60 +  }
    1.61 +}
    1.62 +
    1.63 +// CHECK#4
    1.64 +var c4=0;
    1.65 +try{
    1.66 +  throw "ex1";
    1.67 +}
    1.68 +catch(er1){
    1.69 +  try{
    1.70 +    throw "ex2";
    1.71 +  }
    1.72 +  catch(er1){
    1.73 +    if (er1==="ex1") $ERROR('#4.1: Exception !=="ex1". Actual: catch previous catching exception');
    1.74 +    if (er1!=="ex2") $ERROR('#4.2: Exception ==="ex2". Actual:  Exception ==='+ er1  );
    1.75 +  }
    1.76 +  if (er1!=="ex1") $ERROR('#4.3: Exception ==="ex1". Actual:  Exception ==='+ er1  );
    1.77 +  if (er1==="ex2") $ERROR('#4.4: Exception !=="ex2". Actual: Catch previous embedded exception');
    1.78 +}
    1.79 +finally{
    1.80 +  c4=1;
    1.81 +}
    1.82 +if (c4!==1) $ERROR('#4.5: "finally" block must be evaluated');
    1.83 +
    1.84 +// CHECK#5
    1.85 +var c5=0;
    1.86 +try{
    1.87 +  try{
    1.88 +    throw "ex2";
    1.89 +  }
    1.90 +  catch(er1){
    1.91 +    if (er1!=="ex2") $ERROR('#5.1: Exception ==="ex2". Actual:  Exception ==='+ er1  );
    1.92 +  }
    1.93 +  throw "ex1";
    1.94 +}
    1.95 +catch(er1){
    1.96 +  if (er1!=="ex1") $ERROR('#5.2: Exception ==="ex1". Actual:  Exception ==='+ er1  );
    1.97 +  if (er1==="ex2") $ERROR('#5.3: Exception !=="ex2". Actual: catch previous embedded exception');
    1.98 +}
    1.99 +finally{
   1.100 +  c5=1;
   1.101 +}
   1.102 +if (c5!==1) $ERROR('#5.4: "finally" block must be evaluated');
   1.103 +
   1.104 +// CHECK#6
   1.105 +var c6=0;
   1.106 +try{
   1.107 +  try{
   1.108 +    throw "ex1";
   1.109 +  }
   1.110 +  catch(er1){
   1.111 +    if (er1!=="ex1") $ERROR('#6.1: Exception ==="ex1". Actual:  Exception ==='+ er1  );
   1.112 +  }
   1.113 +}
   1.114 +finally{
   1.115 +  c6=1;		
   1.116 +}
   1.117 +if (c6!==1) $ERROR('#6.2: "finally" block must be evaluated');
   1.118 +
   1.119 +// CHECK#7
   1.120 +var c7=0;
   1.121 +try{
   1.122 +  try{
   1.123 +    throw "ex1";
   1.124 +  }
   1.125 +  finally{
   1.126 +    try{
   1.127 +      c7=1;
   1.128 +      throw "ex2";
   1.129 +    }
   1.130 +    catch(er1){
   1.131 +      if (er1!=="ex2") $ERROR('#7.1: Exception ==="ex2". Actual:  Exception ==='+ er1  );
   1.132 +      if (er1==="ex1") $ERROR('#7.2: Exception !=="ex1". Actual: catch previous embedded exception');
   1.133 +      c7++;
   1.134 +    }
   1.135 +  }
   1.136 +}
   1.137 +catch(er1){
   1.138 +  if (er1!=="ex1") $ERROR('#7.3: Exception ==="ex1". Actual:  Exception ==='+ er1  );
   1.139 +}
   1.140 +if (c7!==2) $ERROR('#7.4: "finally" block must be evaluated');
   1.141 +

mercurial