michael@0: // Copyright 2009 the Sputnik authors. All rights reserved. michael@0: // This code is governed by the BSD license found in the LICENSE file. michael@0: michael@0: /** michael@0: * Using "try" with "catch" or "finally" statement within/without a "while" statement michael@0: * michael@0: * @path ch12/12.14/S12.14_A10_T5.js michael@0: * @description Throw some exceptions from different place of loop body michael@0: */ michael@0: michael@0: // CHECK#1 michael@0: var c=0, i=0; michael@0: var fin=0; michael@0: while(i<10){ michael@0: i+=1; michael@0: try{ michael@0: if(c===0){ michael@0: throw "ex1"; michael@0: $ERROR('#1.1: throw "ex1" lead to throwing exception'); michael@0: } michael@0: c+=2; michael@0: if(c===1){ michael@0: throw "ex2"; michael@0: $ERROR('#1.2: throw "ex2" lead to throwing exception'); michael@0: } michael@0: } michael@0: catch(er1){ michael@0: c-=1; michael@0: continue; michael@0: $ERROR('#1.3: "try catch{continue} finally" must work correctly'); michael@0: } michael@0: finally{ michael@0: fin+=1; michael@0: } michael@0: } michael@0: if(fin!==10){ michael@0: $ERROR('#1.4: "finally" block must be evaluated'); michael@0: } michael@0: