js/src/tests/js1_2/regexp/RegExp_lastMatch.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/. */
     7 /**
     8    Filename:     RegExp_lastMatch.js
     9    Description:  'Tests RegExps lastMatch property'
    11    Author:       Nick Lerissa
    12    Date:         March 12, 1998
    13 */
    15 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
    16 var VERSION = 'no version';
    17 startTest();
    18 var TITLE   = 'RegExp: lastMatch';
    20 writeHeaderToLog('Executing script: RegExp_lastMatch.js');
    21 writeHeaderToLog( SECTION + " "+ TITLE);
    24 // 'foo'.match(/foo/); RegExp.lastMatch
    25 'foo'.match(/foo/);
    26 new TestCase ( SECTION, "'foo'.match(/foo/); RegExp.lastMatch",
    27 	       'foo', RegExp.lastMatch);
    29 // 'foo'.match(new RegExp('foo')); RegExp.lastMatch
    30 'foo'.match(new RegExp('foo'));
    31 new TestCase ( SECTION, "'foo'.match(new RegExp('foo')); RegExp.lastMatch",
    32 	       'foo', RegExp.lastMatch);
    34 // 'xxx'.match(/bar/); RegExp.lastMatch
    35 'xxx'.match(/bar/);
    36 new TestCase ( SECTION, "'xxx'.match(/bar/); RegExp.lastMatch",
    37 	       'foo', RegExp.lastMatch);
    39 // 'xxx'.match(/$/); RegExp.lastMatch
    40 'xxx'.match(/$/);
    41 new TestCase ( SECTION, "'xxx'.match(/$/); RegExp.lastMatch",
    42 	       '', RegExp.lastMatch);
    44 // 'abcdefg'.match(/^..(cd)[a-z]+/); RegExp.lastMatch
    45 'abcdefg'.match(/^..(cd)[a-z]+/);
    46 new TestCase ( SECTION, "'abcdefg'.match(/^..(cd)[a-z]+/); RegExp.lastMatch",
    47 	       'abcdefg', RegExp.lastMatch);
    49 // 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/); RegExp.lastMatch
    50 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/);
    51 new TestCase ( SECTION, "'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\\1/); RegExp.lastMatch",
    52 	       'abcdefgabcdefg', RegExp.lastMatch);
    54 test();

mercurial