Debian Codegraph @

js/src/tests/test262/language/statements/try/S12.14_A12_T1.js

raw
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 Using "try" with "catch" or "finally" statement within/without a "for-in"
7 statement
8 es5id: 12.14_A12_T1
9 description: Loop inside try Block, where throw exception
10 ---*/
11
12 var x;
13 var mycars = new Array();
14 mycars[0] = "Saab";
15 mycars[1] = "Volvo";
16 mycars[2] = "BMW";
17
18 // CHECK#1
19 try{
20 for (x in mycars){
21 if (mycars[x]==="BMW") throw "ex";
22 }
23 }
24 catch(e){
25 if(e!=="ex")throw new Test262Error('#1: Exception ==="ex". Actual: Exception ==='+ e );
26 }
27
28 reportCompare(0, 0);