|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 /* |
|
7 * Date: 12 Mar 2001 |
|
8 * |
|
9 * |
|
10 * SUMMARY: Testing Array.prototype.toLocaleString() |
|
11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=56883 |
|
12 * See http://bugzilla.mozilla.org/show_bug.cgi?id=58031 |
|
13 * |
|
14 * By ECMA3 15.4.4.3, myArray.toLocaleString() means that toLocaleString() |
|
15 * should be applied to each element of the array, and the results should be |
|
16 * concatenated with an implementation-specific delimiter. For example: |
|
17 * |
|
18 * myArray[0].toLocaleString() + ',' + myArray[1].toLocaleString() + etc. |
|
19 * |
|
20 * In this testcase toLocaleString is a user-defined property of each |
|
21 * array element; therefore it is the function that should be |
|
22 * invoked. This function increments a global variable. Therefore the |
|
23 * end value of this variable should be myArray.length. |
|
24 */ |
|
25 //----------------------------------------------------------------------------- |
|
26 var BUGNUMBER = 56883; |
|
27 var summary = 'Testing Array.prototype.toLocaleString() -'; |
|
28 var actual = ''; |
|
29 var expect = ''; |
|
30 var n = 0; |
|
31 var obj = {toLocaleString: function() {n++}}; |
|
32 var myArray = [obj, obj, obj]; |
|
33 |
|
34 |
|
35 myArray.toLocaleString(); |
|
36 actual = n; |
|
37 expect = 3; // (see explanation above) |
|
38 |
|
39 |
|
40 //----------------------------------------------------------------------------- |
|
41 test(); |
|
42 //----------------------------------------------------------------------------- |
|
43 |
|
44 |
|
45 function test() |
|
46 { |
|
47 enterFunc ('test'); |
|
48 printBugNumber(BUGNUMBER); |
|
49 printStatus (summary); |
|
50 |
|
51 reportCompare(expect, actual, summary); |
|
52 |
|
53 exitFunc ('test'); |
|
54 } |