2
* The contents of this file are subject to the Netscape Public
3
* License Version 1.1 (the "License"); you may not use this file
4
* except in compliance with the License. You may obtain a copy of
5
* the License at http://www.mozilla.org/NPL/
7
* Software distributed under the License is distributed on an "AS
8
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9
* implied. See the License for the specific language governing
10
* rights and limitations under the License.
12
* The Original Code is mozilla.org code.
14
* The Initial Developer of the Original Code is Netscape
15
* Communications Corporation. Portions created by Netscape are
16
* Copyright (C) 1998 Netscape Communications Corporation.
17
* All Rights Reserved.
19
* Contributor(s): pschwartau@netscape.com
23
* SUMMARY: Testing Array.prototype.toLocaleString()
24
* See http://bugzilla.mozilla.org/show_bug.cgi?id=56883
25
* See http://bugzilla.mozilla.org/show_bug.cgi?id=58031
27
* By ECMA3 15.4.4.3, myArray.toLocaleString() means that toLocaleString()
28
* should be applied to each element of the array, and the results should be
29
* concatenated with an implementation-specific delimiter. For example:
31
* myArray[0].toLocaleString() + ',' + myArray[1].toLocaleString() + etc.
33
* In this testcase toLocaleString is a user-defined property of each array element;
34
* therefore it is the function that should be invoked. This function increments a
35
* global variable. Therefore the end value of this variable should be myArray.length.
37
//-------------------------------------------------------------------------------------------------
39
var summary = 'Testing Array.prototype.toLocaleString() -';
43
var obj = {toLocaleString: function() {n++}};
44
var myArray = [obj, obj, obj];
47
myArray.toLocaleString();
49
expect = 3; // (see explanation above)
52
//-------------------------------------------------------------------------------------------------
54
//-------------------------------------------------------------------------------------------------
61
printStatus (summary);
63
reportCompare(expect, actual, summary);