1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/test262/ch12/12.14/S12.14_A10_T5.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,39 @@ 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 + * Using "try" with "catch" or "finally" statement within/without a "while" statement 1.9 + * 1.10 + * @path ch12/12.14/S12.14_A10_T5.js 1.11 + * @description Throw some exceptions from different place of loop body 1.12 + */ 1.13 + 1.14 +// CHECK#1 1.15 +var c=0, i=0; 1.16 +var fin=0; 1.17 +while(i<10){ 1.18 + i+=1; 1.19 + try{ 1.20 + if(c===0){ 1.21 + throw "ex1"; 1.22 + $ERROR('#1.1: throw "ex1" lead to throwing exception'); 1.23 + } 1.24 + c+=2; 1.25 + if(c===1){ 1.26 + throw "ex2"; 1.27 + $ERROR('#1.2: throw "ex2" lead to throwing exception'); 1.28 + } 1.29 + } 1.30 + catch(er1){ 1.31 + c-=1; 1.32 + continue; 1.33 + $ERROR('#1.3: "try catch{continue} finally" must work correctly'); 1.34 + } 1.35 + finally{ 1.36 + fin+=1; 1.37 + } 1.38 +} 1.39 +if(fin!==10){ 1.40 + $ERROR('#1.4: "finally" block must be evaluated'); 1.41 +} 1.42 +