Backed out 3 changesets (bug 1892041) for causing failures on async-module-does-not...
[gecko.git] / js / src / tests / test262 / built-ins / Array / prototype / concat / S15.4.4.4_A3_T3.js
blob270a2a0137c9027f7bbdbc8fc7d31b2e3d1557bd
1 // Copyright (c) 2014 Ecma International.  All rights reserved.
2 // See LICENSE or https://github.com/tc39/test262/blob/HEAD/LICENSE
4 /*---
5 esid: sec-array.prototype.concat
6 info: Array.prototype.concat uses [[Get]] on 'length' to determine array length
7 es5id: 15.4.4.4_A3_T3
8 description: >
9   checking whether non-ownProperties are seen, copied by Array.prototype.concat: Object.prototype[1]
10 ---*/
12 var a = [0];
14 assert.sameValue(a.length, 1, 'The value of a.length is expected to be 1');
16 a.length = 3;
18 assert.sameValue(a[1], undefined, 'The value of a[1] is expected to equal undefined');
19 assert.sameValue(a[2], undefined, 'The value of a[2] is expected to equal undefined');
21 Object.prototype[2] = 2;
23 assert.sameValue(a[1], undefined, 'The value of a[1] is expected to equal undefined');
24 assert.sameValue(a[2], 2, 'The value of a[2] is expected to be 2');
25 assert.sameValue(a.hasOwnProperty('1'), false, 'a.hasOwnProperty("1") must return false');
26 assert.sameValue(a.hasOwnProperty('2'), false, 'a.hasOwnProperty("2") must return false');
28 var b = a.concat();
30 assert.sameValue(b.length, 3, 'The value of b.length is expected to be 3');
31 assert.sameValue(b[0], 0, 'The value of b[0] is expected to be 0');
32 assert.sameValue(b[1], undefined, 'The value of b[1] is expected to equal undefined');
33 assert.sameValue(b[2], 2, 'The value of b[2] is expected to be 2');
34 assert.sameValue(b.hasOwnProperty('1'), false, 'b.hasOwnProperty("1") must return false');
35 assert.sameValue(b.hasOwnProperty('2'), true, 'b.hasOwnProperty("2") must return true');
37 reportCompare(0, 0);