js/src/tests/js1_2/regexp/RegExp_lastIndex.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/js1_2/regexp/RegExp_lastIndex.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,52 @@
     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 +   Filename:     RegExp_lastIndex.js
    1.13 +   Description:  'Tests RegExps lastIndex property'
    1.14 +
    1.15 +   Author:       Nick Lerissa
    1.16 +   Date:         March 17, 1998
    1.17 +*/
    1.18 +
    1.19 +var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
    1.20 +var VERSION = 'no version';
    1.21 +var TITLE   = 'RegExp: lastIndex';
    1.22 +var BUGNUMBER="123802";
    1.23 +
    1.24 +startTest();
    1.25 +writeHeaderToLog('Executing script: RegExp_lastIndex.js');
    1.26 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.27 +
    1.28 +// re=/x./g; re.lastIndex=4; re.exec('xyabcdxa');
    1.29 +re=/x./g;
    1.30 +re.lastIndex=4;
    1.31 +new TestCase ( SECTION, "re=/x./g; re.lastIndex=4; re.exec('xyabcdxa')",
    1.32 +	       '["xa"]', String(re.exec('xyabcdxa')));
    1.33 +
    1.34 +// re.lastIndex
    1.35 +new TestCase ( SECTION, "re.lastIndex",
    1.36 +	       8, re.lastIndex);
    1.37 +
    1.38 +// re.exec('xyabcdef');
    1.39 +new TestCase ( SECTION, "re.exec('xyabcdef')",
    1.40 +	       null, re.exec('xyabcdef'));
    1.41 +
    1.42 +// re.lastIndex
    1.43 +new TestCase ( SECTION, "re.lastIndex",
    1.44 +	       0, re.lastIndex);
    1.45 +
    1.46 +// re.exec('xyabcdef');
    1.47 +new TestCase ( SECTION, "re.exec('xyabcdef')",
    1.48 +	       '["xy"]', String(re.exec('xyabcdef')));
    1.49 +
    1.50 +// re.lastIndex=30; re.exec('123xaxbxc456');
    1.51 +re.lastIndex=30;
    1.52 +new TestCase ( SECTION, "re.lastIndex=30; re.exec('123xaxbxc456')",
    1.53 +	       null, re.exec('123xaxbxc456'));
    1.54 +
    1.55 +test();

mercurial