js/src/tests/js1_2/Array/array_split_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/array_split_1.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,53 @@
     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:          array_split_1.js
    1.13 +   ECMA Section:       Array.split()
    1.14 +   Description:
    1.15 +
    1.16 +   These are tests from free perl suite.
    1.17 +
    1.18 +   Author:             christine@netscape.com
    1.19 +   Date:               12 november 1997
    1.20 +*/
    1.21 +
    1.22 +var SECTION = "Free Perl";
    1.23 +var VERSION = "JS1_2";
    1.24 +var TITLE   = "Array.split()";
    1.25 +
    1.26 +startTest();
    1.27 +
    1.28 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.29 +
    1.30 +
    1.31 +new TestCase( SECTION,
    1.32 +	      "('a,b,c'.split(',')).length",
    1.33 +	      3,
    1.34 +	      ('a,b,c'.split(',')).length );
    1.35 +
    1.36 +new TestCase( SECTION,
    1.37 +	      "('a,b'.split(',')).length",
    1.38 +	      2,
    1.39 +	      ('a,b'.split(',')).length );
    1.40 +
    1.41 +new TestCase( SECTION,
    1.42 +	      "('a'.split(',')).length",
    1.43 +	      1,
    1.44 +	      ('a'.split(',')).length );
    1.45 +
    1.46 +/*
    1.47 + * Deviate from ECMA by never splitting an empty string by any separator
    1.48 + * string into a non-empty array (an array of length 1 that contains the
    1.49 + * empty string).
    1.50 + */
    1.51 +new TestCase( SECTION,
    1.52 +	      "(''.split(',')).length",
    1.53 +	      0,
    1.54 +	      (''.split(',')).length );
    1.55 +
    1.56 +test();

mercurial