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