Debian Codegraph @

js/src/tests/test262/built-ins/Array/S15.4.5.2_A3_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 info: |
6 If the length property is changed, every property whose name
7 is an array index whose value is not smaller than the new length is automatically deleted
8 es5id: 15.4.5.2_A3_T1
9 description: >
10 If new length greater than the name of every property whose name
11 is an array index
12 ---*/
13
14 var x = [];
15 x.length = 1;
16 assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
17
18 x[5] = 1;
19 x.length = 10;
20 assert.sameValue(x.length, 10, 'The value of x.length is expected to be 10');
21 assert.sameValue(x[5], 1, 'The value of x[5] is expected to be 1');
22
23 reportCompare(0, 0);