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

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 // Copyright 2009 the Sputnik authors. All rights reserved.
michael@0 2 // This code is governed by the BSD license found in the LICENSE file.
michael@0 3
michael@0 4 /**
michael@0 5 * Using "try" with "catch" or "finally" statement within/without a "for" statement
michael@0 6 *
michael@0 7 * @path ch12/12.14/S12.14_A11_T4.js
michael@0 8 * @description Try statement inside loop, where combinate using break and continue
michael@0 9 */
michael@0 10
michael@0 11 // CHECK#1
michael@0 12 var c1=0,fin=0;
michael@0 13 for(var i=0;i<5;i++){
michael@0 14 try{
michael@0 15 c1+=1;
michael@0 16 break;
michael@0 17 }
michael@0 18 catch(er1){}
michael@0 19 finally{
michael@0 20 fin=1;
michael@0 21 continue;
michael@0 22 }
michael@0 23 fin=-1;
michael@0 24 c1+=2;
michael@0 25 }
michael@0 26 if(fin!==1){
michael@0 27 $ERROR('#1.1: "finally" block must be evaluated');
michael@0 28 }
michael@0 29 if(c1!==5){
michael@0 30 $ERROR('#1.2: "try{break} catch finally{continue}" must work correctly');
michael@0 31 }
michael@0 32
michael@0 33 // CHECK#2
michael@0 34 var c2=0,fin2=0;
michael@0 35 for(var i=0;i<5;i++){
michael@0 36 try{
michael@0 37 throw "ex1";
michael@0 38 }
michael@0 39 catch(er1){
michael@0 40 c2+=1;
michael@0 41 break;
michael@0 42 }
michael@0 43 finally{
michael@0 44 fin2=1;
michael@0 45 continue;
michael@0 46 }
michael@0 47 c2+=2;
michael@0 48 fin2=-1;
michael@0 49 }
michael@0 50 if(fin2!==1){
michael@0 51 $ERROR('#2.1: "finally" block must be evaluated');
michael@0 52 }
michael@0 53 if(c2!==5){
michael@0 54 $ERROR('#2.2: "try catch{break} finally{continue}" must work correctly');
michael@0 55 }
michael@0 56

mercurial