Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Array/length/S15.4.5.1_A1.1_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-exotic-objects-defineownproperty-p-desc
6 info: If ToUint32(length) !== ToNumber(length), throw RangeError
7 es5id: 15.4.5.1_A1.1_T1
8 description: length in [4294967296, -1, 1.5]
9 ---*/
10
11 //CHECK#1
12 try {
13 var x = [];
14 x.length = 4294967296;
15 $ERROR('#1.1: x = []; x.length = 4294967296 throw RangeError. Actual: x.length === ' + (x.length));
16 } catch (e) {
17 if ((e instanceof RangeError) !== true) {
18 $ERROR('#1.2: x = []; x.length = 4294967296 throw RangeError. Actual: ' + (e));
19 }
20 }
21
22 //CHECK#2
23 try {
24 x = [];
25 x.length = -1;
26 $ERROR('#2.1: x = []; x.length = -1 throw RangeError. Actual: x.length === ' + (x.length));
27 } catch (e) {
28 if ((e instanceof RangeError) !== true) {
29 $ERROR('#2.2: x = []; x.length = -1 throw RangeError. Actual: ' + (e));
30 }
31 }
32
33 //CHECK#3
34 try {
35 x = [];
36 x.length = 1.5;
37 $ERROR('#3.1: x = []; x.length = 1.5 throw RangeError. Actual: x.length === ' + (x.length));
38 } catch (e) {
39 if ((e instanceof RangeError) !== true) {
40 $ERROR('#3.2: x = []; x.length = 1.5 throw RangeError. Actual: ' + (e));
41 }
42 }