|
1 /* |
|
2 * Any copyright is dedicated to the Public Domain. |
|
3 * http://creativecommons.org/licenses/publicdomain/ |
|
4 * Contributor: |
|
5 * Jeff Walden <jwalden+code@mit.edu> |
|
6 */ |
|
7 |
|
8 //----------------------------------------------------------------------------- |
|
9 var BUGNUMBER = 562446; |
|
10 var summary = 'ES5: Array.prototype.toLocaleString'; |
|
11 |
|
12 print(BUGNUMBER + ": " + summary); |
|
13 |
|
14 /************** |
|
15 * BEGIN TEST * |
|
16 **************/ |
|
17 |
|
18 var o; |
|
19 |
|
20 o = { length: 2, 0: 7, 1: { toLocaleString: function() { return "baz" } } }; |
|
21 assertEq(Array.prototype.toLocaleString.call(o), "7,baz"); |
|
22 |
|
23 o = {}; |
|
24 assertEq(Array.prototype.toLocaleString.call(o), ""); |
|
25 |
|
26 var log = ''; |
|
27 arr = {length: {valueOf: function () { log += "L"; return 2; }}, |
|
28 0: "x", 1: "z"}; |
|
29 assertEq(Array.prototype.toLocaleString.call(arr), "x,z"); |
|
30 assertEq(log, "L"); |
|
31 |
|
32 /******************************************************************************/ |
|
33 |
|
34 reportCompare(true, true); |
|
35 |
|
36 print("All tests passed!"); |