michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: * Date: 12 Mar 2001 michael@0: * michael@0: * michael@0: * SUMMARY: Testing Array.prototype.toLocaleString() michael@0: * See http://bugzilla.mozilla.org/show_bug.cgi?id=56883 michael@0: * See http://bugzilla.mozilla.org/show_bug.cgi?id=58031 michael@0: * michael@0: * By ECMA3 15.4.4.3, myArray.toLocaleString() means that toLocaleString() michael@0: * should be applied to each element of the array, and the results should be michael@0: * concatenated with an implementation-specific delimiter. For example: michael@0: * michael@0: * myArray[0].toLocaleString() + ',' + myArray[1].toLocaleString() + etc. michael@0: * michael@0: * In this testcase toLocaleString is a user-defined property of each michael@0: * array element; therefore it is the function that should be michael@0: * invoked. This function increments a global variable. Therefore the michael@0: * end value of this variable should be myArray.length. michael@0: */ michael@0: //----------------------------------------------------------------------------- michael@0: var BUGNUMBER = 56883; michael@0: var summary = 'Testing Array.prototype.toLocaleString() -'; michael@0: var actual = ''; michael@0: var expect = ''; michael@0: var n = 0; michael@0: var obj = {toLocaleString: function() {n++}}; michael@0: var myArray = [obj, obj, obj]; michael@0: michael@0: michael@0: myArray.toLocaleString(); michael@0: actual = n; michael@0: expect = 3; // (see explanation above) michael@0: michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: test(); michael@0: //----------------------------------------------------------------------------- michael@0: michael@0: michael@0: function test() michael@0: { michael@0: enterFunc ('test'); michael@0: printBugNumber(BUGNUMBER); michael@0: printStatus (summary); michael@0: michael@0: reportCompare(expect, actual, summary); michael@0: michael@0: exitFunc ('test'); michael@0: }