S12.1_A5.js (1575B)
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: | 6 StatementList: StatementList Statement inside the Block is evaluated from 7 left to right 8 es5id: 12.1_A5 9 description: Throwing exceptions within embedded/sequence Blocks 10 ---*/ 11 12 ////////////////////////////////////////////////////////////////////////////// 13 //CHECK#1 14 try { 15 throw 1; 16 throw 2; 17 throw 3; 18 throw new Test262Error('1.1: throw 1 lead to throwing exception'); 19 } catch (e) { 20 if (e!==1) { 21 throw new Test262Error('#1.2: Exception === 1. Actual: Exception ==='+ e); 22 } 23 } 24 //////////////////////////////////////////////////////////////////////////////// 25 26 ////////////////////////////////////////////////////////////////////////////// 27 //CHECK#2 28 try { 29 { 30 throw 1; 31 throw 2; 32 } 33 throw 3; 34 throw new Test262Error('#2.1: throw 1 lead to throwing exception'); 35 } catch (e) { 36 if (e!==1) { 37 throw new Test262Error('#2.2: Exception === 1. Actual: Exception ==='+ e); 38 } 39 } 40 //////////////////////////////////////////////////////////////////////////////// 41 42 ////////////////////////////////////////////////////////////////////////////// 43 //CHECK#3 44 try { 45 throw 1; 46 { 47 throw 2; 48 throw 3; 49 } 50 throw new Test262Error('#3.1: throw 1 lead to throwing exception'); 51 } catch (e) { 52 if (e!==1) { 53 throw new Test262Error('#3.2: Exception === 1. Actual: Exception ==='+ e); 54 } 55 } 56 //////////////////////////////////////////////////////////////////////////////// 57 58 reportCompare(0, 0);