js/src/tests/js1_2/regexp/RegExp_lastParen_as_array.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_lastParen_as_array.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,68 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +
    1.10 +/**
    1.11 +   Filename:     RegExp_lastParen_as_array.js
    1.12 +   Description:  'Tests RegExps $+ property (same tests as RegExp_lastParen.js but using $+)'
    1.13 +
    1.14 +   Author:       Nick Lerissa
    1.15 +   Date:         March 13, 1998
    1.16 +*/
    1.17 +
    1.18 +var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
    1.19 +var VERSION = 'no version';
    1.20 +startTest();
    1.21 +var TITLE   = 'RegExp: $+';
    1.22 +
    1.23 +writeHeaderToLog('Executing script: RegExp_lastParen_as_array.js');
    1.24 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.25 +
    1.26 +// 'abcd'.match(/(abc)d/); RegExp['$+']
    1.27 +'abcd'.match(/(abc)d/);
    1.28 +new TestCase ( SECTION, "'abcd'.match(/(abc)d/); RegExp['$+']",
    1.29 +	       'abc', RegExp['$+']);
    1.30 +
    1.31 +// 'abcd'.match(/(bcd)e/); RegExp['$+']
    1.32 +'abcd'.match(/(bcd)e/);
    1.33 +new TestCase ( SECTION, "'abcd'.match(/(bcd)e/); RegExp['$+']",
    1.34 +	       'abc', RegExp['$+']);
    1.35 +
    1.36 +// 'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp['$+']
    1.37 +'abcdefg'.match(/(a(b(c(d)e)f)g)/);
    1.38 +new TestCase ( SECTION, "'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp['$+']",
    1.39 +	       'd', RegExp['$+']);
    1.40 +
    1.41 +// 'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)')); RegExp['$+']
    1.42 +'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)'));
    1.43 +new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)')); RegExp['$+']",
    1.44 +	       'd', RegExp['$+']);
    1.45 +
    1.46 +// 'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp['$+']
    1.47 +'abcdefg'.match(/(a(b)c)(d(e)f)/);
    1.48 +new TestCase ( SECTION, "'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp['$+']",
    1.49 +	       'e', RegExp['$+']);
    1.50 +
    1.51 +// 'abcdefg'.match(/(^)abc/); RegExp['$+']
    1.52 +'abcdefg'.match(/(^)abc/);
    1.53 +new TestCase ( SECTION, "'abcdefg'.match(/(^)abc/); RegExp['$+']",
    1.54 +	       '', RegExp['$+']);
    1.55 +
    1.56 +// 'abcdefg'.match(/(^a)bc/); RegExp['$+']
    1.57 +'abcdefg'.match(/(^a)bc/);
    1.58 +new TestCase ( SECTION, "'abcdefg'.match(/(^a)bc/); RegExp['$+']",
    1.59 +	       'a', RegExp['$+']);
    1.60 +
    1.61 +// 'abcdefg'.match(new RegExp('(^a)bc')); RegExp['$+']
    1.62 +'abcdefg'.match(new RegExp('(^a)bc'));
    1.63 +new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(^a)bc')); RegExp['$+']",
    1.64 +	       'a', RegExp['$+']);
    1.65 +
    1.66 +// 'abcdefg'.match(/bc/); RegExp['$+']
    1.67 +'abcdefg'.match(/bc/);
    1.68 +new TestCase ( SECTION, "'abcdefg'.match(/bc/); RegExp['$+']",
    1.69 +	       '', RegExp['$+']);
    1.70 +
    1.71 +test();

mercurial