js/src/tests/js1_2/regexp/RegExp_dollar_number.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_dollar_number.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,77 @@
     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_dollar_number.js
    1.12 +   Description:  'Tests RegExps $1, ..., $9 properties'
    1.13 +
    1.14 +   Author:       Nick Lerissa
    1.15 +   Date:         March 12, 1998
    1.16 +*/
    1.17 +
    1.18 +var SECTION = 'As described in Netscape doc "What\'s new in JavaScript 1.2"';
    1.19 +var VERSION = 'no version';
    1.20 +var TITLE   = 'RegExp: $1, ..., $9';
    1.21 +var BUGNUMBER="123802";
    1.22 +
    1.23 +startTest();
    1.24 +writeHeaderToLog('Executing script: RegExp_dollar_number.js');
    1.25 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.26 +
    1.27 +
    1.28 +// 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$1
    1.29 +'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/);
    1.30 +new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$1",
    1.31 +	       'abcdefghi', RegExp.$1);
    1.32 +
    1.33 +// 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$2
    1.34 +new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$2",
    1.35 +	       'bcdefgh', RegExp.$2);
    1.36 +
    1.37 +// 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$3
    1.38 +new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$3",
    1.39 +	       'cdefg', RegExp.$3);
    1.40 +
    1.41 +// 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$4
    1.42 +new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$4",
    1.43 +	       'def', RegExp.$4);
    1.44 +
    1.45 +// 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$5
    1.46 +new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$5",
    1.47 +	       'e', RegExp.$5);
    1.48 +
    1.49 +// 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$6
    1.50 +new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$6",
    1.51 +	       '', RegExp.$6);
    1.52 +
    1.53 +var a_to_z = 'abcdefghijklmnopqrstuvwxyz';
    1.54 +var regexp1 = /(a)b(c)d(e)f(g)h(i)j(k)l(m)n(o)p(q)r(s)t(u)v(w)x(y)z/
    1.55 +  // 'abcdefghijklmnopqrstuvwxyz'.match(/(a)b(c)d(e)f(g)h(i)j(k)l(m)n(o)p(q)r(s)t(u)v(w)x(y)z/); RegExp.$1
    1.56 +  a_to_z.match(regexp1);
    1.57 +
    1.58 +new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$1",
    1.59 +	       'a', RegExp.$1);
    1.60 +new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$2",
    1.61 +	       'c', RegExp.$2);
    1.62 +new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$3",
    1.63 +	       'e', RegExp.$3);
    1.64 +new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$4",
    1.65 +	       'g', RegExp.$4);
    1.66 +new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$5",
    1.67 +	       'i', RegExp.$5);
    1.68 +new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$6",
    1.69 +	       'k', RegExp.$6);
    1.70 +new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$7",
    1.71 +	       'm', RegExp.$7);
    1.72 +new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$8",
    1.73 +	       'o', RegExp.$8);
    1.74 +new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$9",
    1.75 +	       'q', RegExp.$9);
    1.76 +/*
    1.77 +  new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$10",
    1.78 +  's', RegExp.$10);
    1.79 +*/
    1.80 +test();

mercurial