Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Array/length/S15.4.2.2_A2.2_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 esid: sec-array-len
6 info: |
7 If the argument len is a Number and ToUint32(len) is not equal to len,
8 a RangeError exception is thrown
9 es5id: 15.4.2.2_A2.2_T1
10 description: Use try statement. len = -1, 4294967296, 4294967297
11 ---*/
12
13 //CHECK#1
14 try {
15 new Array(-1);
16 $ERROR('#1.1: new Array(-1) throw RangeError. Actual: ' + (new Array(-1)));
17 } catch (e) {
18 if ((e instanceof RangeError) !== true) {
19 $ERROR('#1.2: new Array(-1) throw RangeError. Actual: ' + (e));
20 }
21 }
22
23 //CHECK#2
24 try {
25 new Array(4294967296);
26 $ERROR('#2.1: new Array(4294967296) throw RangeError. Actual: ' + (new Array(4294967296)));
27 } catch (e) {
28 if ((e instanceof RangeError) !== true) {
29 $ERROR('#2.2: new Array(4294967296) throw RangeError. Actual: ' + (e));
30 }
31 }
32
33 //CHECK#3
34 try {
35 new Array(4294967297);
36 $ERROR('#3.1: new Array(4294967297) throw RangeError. Actual: ' + (new Array(4294967297)));
37 } catch (e) {
38 if ((e instanceof RangeError) !== true) {
39 $ERROR('#3.2: new Array(4294967297) throw RangeError. Actual: ' + (e));
40 }
41 }