Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Array/length/S15.4.5.1_A1.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-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_T3
12 description: Checking an inherited property
13 ---*/
14
15 //CHECK#1
16 Array.prototype[2] = 2;
17 var x = [0, 1];
18 x.length = 3;
19 if (x.hasOwnProperty('2') !== false) {
20 $ERROR('#1: Array.prototype[2] = 2; x = [0,1]; x.length = 3; x.hasOwnProperty(\'2\') === false. Actual: ' + (x.hasOwnProperty('2')));
21 }
22
23 //CHECK#2
24 x.length = 2;
25 if (x[2] !== 2) {
26 $ERROR('#2: Array.prototype[2] = 2; x = [0,1]; x.length = 3; x.length = 2; x[2] === 2. Actual: ' + (x[2]));
27 }