|
1 /* |
|
2 * Any copyright is dedicated to the Public Domain. |
|
3 * http://creativecommons.org/licenses/publicdomain/ |
|
4 */ |
|
5 |
|
6 //----------------------------------------------------------------------------- |
|
7 var BUGNUMBER = 614070; |
|
8 var summary = 'Array.prototype.unshift without args'; |
|
9 |
|
10 print(BUGNUMBER + ": " + summary); |
|
11 |
|
12 /************** |
|
13 * BEGIN TEST * |
|
14 **************/ |
|
15 |
|
16 var a = {}; |
|
17 a.length = 4294967296; |
|
18 assertEq([].unshift.call(a), 0); |
|
19 assertEq(a.length, 0); |
|
20 |
|
21 function testGetSet(len, expected) { |
|
22 var newlen; |
|
23 var a = { get length() { return len; }, set length(v) { newlen = v; } }; |
|
24 var res = [].unshift.call(a); |
|
25 assertEq(res, expected); |
|
26 assertEq(newlen, expected); |
|
27 } |
|
28 |
|
29 testGetSet(0, 0); |
|
30 testGetSet(10, 10); |
|
31 testGetSet("1", 1); |
|
32 testGetSet(null, 0); |
|
33 testGetSet(4294967297, 1); |
|
34 testGetSet(-5, 4294967291); |
|
35 |
|
36 /******************************************************************************/ |
|
37 |
|
38 if (typeof reportCompare === "function") |
|
39 reportCompare(true, true); |
|
40 |
|
41 print("All tests passed!"); |