Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Array/length/S15.4.5.2_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 esid: sec-properties-of-array-instances-length
6 info: |
7 If the length property is changed, every property whose name
8 is an array index whose value is not smaller than the new length is automatically deleted
9 es5id: 15.4.5.2_A3_T4
10 description: >
11 If new length greater than the name of every property whose name
12 is an array index
13 ---*/
14
15 //CHECK#1
16 var x = [0, 1, 2];
17 x[4294967294] = 4294967294;
18 x.length = 2;
19
20 //CHECK#1
21 if (x[0] !== 0) {
22 $ERROR('#1: x = [0,1,2]; x[4294967294] = 4294967294; x.length = 2; x[0] === 0. Actual: ' + (x[0]));
23 }
24
25 //CHECK#2
26 if (x[1] !== 1) {
27 $ERROR('#2: x = [0,1,2]; x[4294967294] = 4294967294; x.length = 2; x[1] === 1. Actual: ' + (x[1]));
28 }
29
30 //CHECK#3
31 if (x[2] !== undefined) {
32 $ERROR('#3: x = [0,1,2]; x[4294967294] = 4294967294; x.length = 2; x[2] === undefined. Actual: ' + (x[2]));
33 }
34
35 //CHECK#4
36 if (x[4294967294] !== undefined) {
37 $ERROR('#4: x = [0,1,2]; x[4294967294] = 4294967294; x.length = 2; x[4294967294] === undefined. Actual: ' + (x[4294967294]));
38 }