S12.14_A6.js (1222B)
1 // Copyright 2009 the Sputnik authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 info: "The production TryStatement: \"try Block Catch Finally\"" 6 es5id: 12.14_A6 7 description: > 8 Executing sequence of "try" statements, using counters with 9 varying values within 10 ---*/ 11 12 // CHECK#1 13 var c1=0; 14 try { 15 c1+=1; 16 y; 17 throw new Test262Error('#1.1: "y" lead to throwing exception'); 18 } 19 catch (e) { 20 c1*=2; 21 } 22 if (c1!==2){ 23 throw new Test262Error('#1.2: Sequence evaluation of commands try/catch is 1. try, 2. catch'); 24 } 25 26 // CHECK#2 27 var c2=0; 28 try{ 29 c2+=1; 30 } 31 finally{ 32 c2*=2; 33 } 34 if (c2!==2){ 35 throw new Test262Error('#2: Sequence evaluation of commands try/finally is 1. try, 2. finally'); 36 } 37 38 // CHECK#3 39 var c3=0; 40 try{ 41 c3=1; 42 z; 43 } 44 catch(err){ 45 c3*=2; 46 } 47 finally{ 48 c3+=1; 49 } 50 if (c3!==3){ 51 throw new Test262Error('#3: Sequence evaluation of commands try/catch/finally(with exception) is 1. try, 2. catch, 3. finally'); 52 } 53 54 // CHECK#4 55 var c4=0; 56 try{ 57 c4=1; 58 } 59 catch(err){ 60 c4*=3; 61 } 62 finally{ 63 c4+=1; 64 } 65 if (c4!==2){ 66 throw new Test262Error('#4: Sequence evaluation of commands try/catch/finally(without exception) is 1. try, 2. finally'); 67 } 68 69 reportCompare(0, 0);