Debian Codegraph @

js/src/tests/test262/language/statements/throw/S12.13_A3_T4.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: 1. Evaluate Expression
6 es5id: 12.13_A3_T4
7 description: Evaluating array expression
8 ---*/
9
10 var mycars = new Array();
11 mycars[0] = "Saab";
12 mycars[1] = "Volvo";
13 mycars[2] = "BMW";
14
15 var mycars2 = new Array();
16 mycars2[0] = "Mercedes";
17 mycars2[1] = "Jeep";
18 mycars2[2] = "Suzuki";
19
20 // CHECK#1
21 try{
22 throw mycars.concat(mycars2);
23 }
24 catch(e){
25 for (var i=0;i<3;i++){
26 if (e[i]!==mycars[i]) throw new Test262Error('#1.'+i+': Exception['+i+']===mycars['+i+'](operation .concat). Actual: Exception['+i+']==='+ e[i] );
27 }
28 for (var i=3;i<6;i++){
29 if (e[i]!==mycars2[i-3]) throw new Test262Error('#1.'+i+': Exception['+i+']===mycars2['+(i-3)+'](operation .concat). Actual: Exception['+i+']==='+ e[i] );
30 }
31 }
32
33 // CHECK#2
34 try{
35 throw new Array("Mercedes","Jeep","Suzuki");
36 }
37 catch(e){
38 for (var i=0;i<3;i++){
39 if (e[i]!==mycars2[i]) throw new Test262Error('#2.'+i+': Exception['+i+']===mycars2['+i+'](operation new). Actual: Exception['+i+']==='+ e[i] );
40 }
41 }
42
43 // CHECK#3
44 try{
45 throw mycars.concat(new Array("Mercedes","Jeep","Suzuki"));
46 }
47 catch(e){
48 for (var i=0;i<3;i++){
49 if (e[i]!==mycars[i]) throw new Test262Error('#3.'+i+': Exception['+i+']===mycars['+i+'](operation .concat(new)). Actual: Exception['+i+']==='+ e[i] );
50 }
51 for (var i=3;i<6;i++){
52 if (e[i]!==mycars2[i-3]) throw new Test262Error('#3.'+i+': Exception['+i+']===mycars2['+(i-3)+'](operation .concat(new)). Actual: Exception['+i+']==='+ e[i] );
53 }
54 }
55
56 reportCompare(0, 0);