js/src/tests/ecma_3/Array/15.4.4.3-1.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/. */
     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];
    35 myArray.toLocaleString();
    36 actual = n;
    37 expect = 3; // (see explanation above)
    40 //-----------------------------------------------------------------------------
    41 test();
    42 //-----------------------------------------------------------------------------
    45 function test()
    46 {
    47   enterFunc ('test');
    48   printBugNumber(BUGNUMBER);
    49   printStatus (summary);
    51   reportCompare(expect, actual, summary);
    53   exitFunc ('test');
    54 }

mercurial