Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Array/length/S15.4.5.1_A1.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-exotic-objects-defineownproperty-p-desc
6 info: |
7 For every integer k that is less than the value of
8 the length property of A but not less than ToUint32(length),
9 if A itself has a property (not an inherited property) named ToString(k),
10 then delete that property
11 es5id: 15.4.5.1_A1.2_T1
12 description: Change length of array
13 ---*/
14
15 //CHECK#1
16 var x = [0, , 2, , 4];
17 x.length = 4;
18 if (x[4] !== undefined) {
19 $ERROR('#1: x = [0,,2,,4]; x.length = 4; x[4] === undefined. Actual: ' + (x[4]));
20 }
21
22 //CHECK#2
23 x.length = 3;
24 if (x[3] !== undefined) {
25 $ERROR('#2: x = [0,,2,,4]; x.length = 4; x.length = 3; x[3] === undefined. Actual: ' + (x[3]));
26 }
27
28 //CHECK#3
29 if (x[2] !== 2) {
30 $ERROR('#3: x = [0,,2,,4]; x.length = 4; x.length = 3; x[2] === 2. Actual: ' + (x[2]));
31 }