1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
5 esid: sec-array.prototype.concat
7 The concat function is intentionally generic.
8 It does not require that its this value be an Array object
10 description: Checking this for Object object, items are objects and primitives
14 x.concat = Array.prototype.concat;
16 var z = new Array(1, 2);
17 var arr = x.concat(y, z, -1, true, "NaN");
19 arr.getClass = Object.prototype.toString;
20 assert.sameValue(arr.getClass(), "[object Array]", 'arr.getClass() must return "[object Array]"');
21 assert.sameValue(arr[0], x, 'The value of arr[0] is expected to equal the value of x');
22 assert.sameValue(arr[1], y, 'The value of arr[1] is expected to equal the value of y');
23 assert.sameValue(arr[2], 1, 'The value of arr[2] is expected to be 1');
24 assert.sameValue(arr[3], 2, 'The value of arr[3] is expected to be 2');
25 assert.sameValue(arr[4], -1, 'The value of arr[4] is expected to be -1');
26 assert.sameValue(arr[5], true, 'The value of arr[5] is expected to be true');
27 assert.sameValue(arr[6], "NaN", 'The value of arr[6] is expected to be "NaN"');
28 assert.sameValue(arr.length, 7, 'The value of arr.length is expected to be 7');