js/src/tests/test262/ch12/12.14/S12.14_A6.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_A6.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,67 @@
     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 + * The production TryStatement: "try Block Catch Finally"
     1.9 + *
    1.10 + * @path ch12/12.14/S12.14_A6.js
    1.11 + * @description Executing sequence of "try" statements, using counters with varying values within
    1.12 + */
    1.13 +
    1.14 +// CHECK#1
    1.15 +var c1=0;
    1.16 +try {
    1.17 +  c1+=1;
    1.18 +  y;
    1.19 +  $ERROR('#1.1: "y" lead to throwing exception');
    1.20 +}
    1.21 +catch (e) {
    1.22 +  c1*=2;
    1.23 +}
    1.24 +if (c1!==2){
    1.25 +  $ERROR('#1.2: Sequence evaluation of commands try/catch is 1. try, 2. catch');	
    1.26 +}
    1.27 +
    1.28 +// CHECK#2
    1.29 +var c2=0;
    1.30 +try{
    1.31 +  c2+=1;
    1.32 +}
    1.33 +finally{
    1.34 +  c2*=2;
    1.35 +}
    1.36 +if (c2!==2){
    1.37 +  $ERROR('#2: Sequence evaluation of commands try/finally is 1. try, 2. finally');
    1.38 +}
    1.39 +
    1.40 +// CHECK#3
    1.41 +var c3=0;
    1.42 +try{
    1.43 +  c3=1;
    1.44 +  z;
    1.45 +}
    1.46 +catch(err){
    1.47 +  c3*=2;
    1.48 +}
    1.49 +finally{
    1.50 +  c3+=1;
    1.51 +}
    1.52 +if (c3!==3){
    1.53 +  $ERROR('#3: Sequence evaluation of commands try/catch/finally(with exception) is 1. try, 2. catch, 3. finally');
    1.54 +}	
    1.55 +
    1.56 +// CHECK#4
    1.57 +var c4=0;
    1.58 +try{
    1.59 +  c4=1;
    1.60 +}
    1.61 +catch(err){
    1.62 +  c4*=3;
    1.63 +}
    1.64 +finally{
    1.65 +  c4+=1;
    1.66 +}
    1.67 +if (c4!==2){
    1.68 +  $ERROR('#4: Sequence evaluation of commands try/catch/finally(without exception) is 1. try, 2. finally');
    1.69 +}	
    1.70 +

mercurial