js/src/tests/js1_2/Array/tostring_1.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 // |reftest| skip -- obsolete test
     2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     8 /**
     9    File Name:          tostring_1.js
    10    ECMA Section:       Array.toString()
    11    Description:
    13    This checks the ToString value of Array objects under JavaScript 1.2.
    15    Author:             christine@netscape.com
    16    Date:               12 november 1997
    17 */
    19 var SECTION = "JS1_2";
    20 var VERSION = "JS1_2";
    21 startTest();
    22 var TITLE   = "Array.toString()";
    24 writeHeaderToLog( SECTION + " "+ TITLE);
    26 var a = new Array();
    28 var VERSION = 0;
    30 if ( version() == 120 ) {
    31   VERSION = "120";
    32 } else {
    33   VERSION = "";
    34 }
    36 new TestCase ( SECTION,
    37 	       "var a = new Array(); a.toString()",
    38 	       ( VERSION == "120" ? "[]" : "" ),
    39 	       a.toString() );
    41 a[0] = void 0;
    43 new TestCase ( SECTION,
    44 	       "a[0] = void 0; a.toString()",
    45 	       ( VERSION == "120" ? "[, ]" : "" ),
    46 	       a.toString() );
    49 new TestCase( SECTION,
    50 	      "a.length",
    51 	      1,
    52 	      a.length );
    54 a[1] = void 0;
    56 new TestCase( SECTION,
    57 	      "a[1] = void 0; a.toString()",
    58 	      ( VERSION == "120" ? "[, , ]" : ","  ),
    59 	      a.toString() );
    61 a[1] = "hi";
    63 new TestCase( SECTION,
    64 	      "a[1] = \"hi\"; a.toString()",
    65 	      ( VERSION == "120" ? "[, \"hi\"]" : ",hi" ),
    66 	      a.toString() );
    68 a[2] = void 0;
    70 new TestCase( SECTION,
    71 	      "a[2] = void 0; a.toString()",
    72 	      ( VERSION == "120" ?"[, \"hi\", , ]":",hi,"),
    73 	      a.toString() );
    75 var b = new Array(1000);
    76 var bstring = "";
    77 for ( blen=0; blen<999; blen++) {
    78   bstring += ",";
    79 }
    82 new TestCase ( SECTION,
    83 	       "var b = new Array(1000); b.toString()",
    84 	       ( VERSION == "120" ? "[1000]" : bstring ),
    85 	       b.toString() );
    88 new TestCase( SECTION,
    89 	      "b.length",
    90 	      ( VERSION == "120" ? 1 : 1000 ),
    91 	      b.length );
    93 test();

mercurial