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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/js1_2/Array/tostring_1.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,93 @@
     1.4 +// |reftest| skip -- obsolete test
     1.5 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +
    1.11 +/**
    1.12 +   File Name:          tostring_1.js
    1.13 +   ECMA Section:       Array.toString()
    1.14 +   Description:
    1.15 +
    1.16 +   This checks the ToString value of Array objects under JavaScript 1.2.
    1.17 +
    1.18 +   Author:             christine@netscape.com
    1.19 +   Date:               12 november 1997
    1.20 +*/
    1.21 +
    1.22 +var SECTION = "JS1_2";
    1.23 +var VERSION = "JS1_2";
    1.24 +startTest();
    1.25 +var TITLE   = "Array.toString()";
    1.26 +
    1.27 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.28 +
    1.29 +var a = new Array();
    1.30 +
    1.31 +var VERSION = 0;
    1.32 +
    1.33 +if ( version() == 120 ) {
    1.34 +  VERSION = "120";
    1.35 +} else {
    1.36 +  VERSION = "";
    1.37 +}
    1.38 +
    1.39 +new TestCase ( SECTION,
    1.40 +	       "var a = new Array(); a.toString()",
    1.41 +	       ( VERSION == "120" ? "[]" : "" ),
    1.42 +	       a.toString() );
    1.43 +
    1.44 +a[0] = void 0;
    1.45 +
    1.46 +new TestCase ( SECTION,
    1.47 +	       "a[0] = void 0; a.toString()",
    1.48 +	       ( VERSION == "120" ? "[, ]" : "" ),
    1.49 +	       a.toString() );
    1.50 +
    1.51 +
    1.52 +new TestCase( SECTION,
    1.53 +	      "a.length",
    1.54 +	      1,
    1.55 +	      a.length );
    1.56 +
    1.57 +a[1] = void 0;
    1.58 +
    1.59 +new TestCase( SECTION,
    1.60 +	      "a[1] = void 0; a.toString()",
    1.61 +	      ( VERSION == "120" ? "[, , ]" : ","  ),
    1.62 +	      a.toString() );
    1.63 +
    1.64 +a[1] = "hi";
    1.65 +
    1.66 +new TestCase( SECTION,
    1.67 +	      "a[1] = \"hi\"; a.toString()",
    1.68 +	      ( VERSION == "120" ? "[, \"hi\"]" : ",hi" ),
    1.69 +	      a.toString() );
    1.70 +
    1.71 +a[2] = void 0;
    1.72 +
    1.73 +new TestCase( SECTION,
    1.74 +	      "a[2] = void 0; a.toString()",
    1.75 +	      ( VERSION == "120" ?"[, \"hi\", , ]":",hi,"),
    1.76 +	      a.toString() );
    1.77 +
    1.78 +var b = new Array(1000);
    1.79 +var bstring = "";
    1.80 +for ( blen=0; blen<999; blen++) {
    1.81 +  bstring += ",";
    1.82 +}
    1.83 +
    1.84 +
    1.85 +new TestCase ( SECTION,
    1.86 +	       "var b = new Array(1000); b.toString()",
    1.87 +	       ( VERSION == "120" ? "[1000]" : bstring ),
    1.88 +	       b.toString() );
    1.89 +
    1.90 +
    1.91 +new TestCase( SECTION,
    1.92 +	      "b.length",
    1.93 +	      ( VERSION == "120" ? 1 : 1000 ),
    1.94 +	      b.length );
    1.95 +
    1.96 +test();

mercurial