Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Array/length/S15.4.2.2_A2.2_T3.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_T3
10 description: Use try statement. len = 1.5, Number.MAX_VALUE, Number.MIN_VALUE
11 ---*/
12
13 //CHECK#1
14 try {
15 new Array(1.5);
16 $ERROR('#1.1: new Array(1.5) throw RangeError. Actual: ' + (new Array(1.5)));
17 } catch (e) {
18 if ((e instanceof RangeError) !== true) {
19 $ERROR('#1.2: new Array(1.5) throw RangeError. Actual: ' + (e));
20 }
21 }
22
23 //CHECK#2
24 try {
25 new Array(Number.MAX_VALUE);
26 $ERROR('#2.1: new Array(Number.MAX_VALUE) throw RangeError. Actual: ' + (new Array(Number.MAX_VALUE)));
27 } catch (e) {
28 if ((e instanceof RangeError) !== true) {
29 $ERROR('#2.2: new Array(Number.MAX_VALUE) throw RangeError. Actual: ' + (e));
30 }
31 }
32
33 //CHECK#3
34 try {
35 new Array(Number.MIN_VALUE);
36 $ERROR('#3.1: new Array(Number.MIN_VALUE) throw RangeError. Actual: ' + (new Array(Number.MIN_VALUE)));
37 } catch (e) {
38 if ((e instanceof RangeError) !== true) {
39 $ERROR('#3.2: new Array(Number.MIN_VALUE) throw RangeError. Actual: ' + (e));
40 }
41 }