js/src/tests/js1_2/regexp/RegExp_dollar_number.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.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6
michael@0 7 /**
michael@0 8 Filename: RegExp_dollar_number.js
michael@0 9 Description: 'Tests RegExps $1, ..., $9 properties'
michael@0 10
michael@0 11 Author: Nick Lerissa
michael@0 12 Date: March 12, 1998
michael@0 13 */
michael@0 14
michael@0 15 var SECTION = 'As described in Netscape doc "What\'s new in JavaScript 1.2"';
michael@0 16 var VERSION = 'no version';
michael@0 17 var TITLE = 'RegExp: $1, ..., $9';
michael@0 18 var BUGNUMBER="123802";
michael@0 19
michael@0 20 startTest();
michael@0 21 writeHeaderToLog('Executing script: RegExp_dollar_number.js');
michael@0 22 writeHeaderToLog( SECTION + " "+ TITLE);
michael@0 23
michael@0 24
michael@0 25 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$1
michael@0 26 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/);
michael@0 27 new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$1",
michael@0 28 'abcdefghi', RegExp.$1);
michael@0 29
michael@0 30 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$2
michael@0 31 new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$2",
michael@0 32 'bcdefgh', RegExp.$2);
michael@0 33
michael@0 34 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$3
michael@0 35 new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$3",
michael@0 36 'cdefg', RegExp.$3);
michael@0 37
michael@0 38 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$4
michael@0 39 new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$4",
michael@0 40 'def', RegExp.$4);
michael@0 41
michael@0 42 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$5
michael@0 43 new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$5",
michael@0 44 'e', RegExp.$5);
michael@0 45
michael@0 46 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$6
michael@0 47 new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$6",
michael@0 48 '', RegExp.$6);
michael@0 49
michael@0 50 var a_to_z = 'abcdefghijklmnopqrstuvwxyz';
michael@0 51 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/
michael@0 52 // '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
michael@0 53 a_to_z.match(regexp1);
michael@0 54
michael@0 55 new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$1",
michael@0 56 'a', RegExp.$1);
michael@0 57 new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$2",
michael@0 58 'c', RegExp.$2);
michael@0 59 new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$3",
michael@0 60 'e', RegExp.$3);
michael@0 61 new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$4",
michael@0 62 'g', RegExp.$4);
michael@0 63 new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$5",
michael@0 64 'i', RegExp.$5);
michael@0 65 new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$6",
michael@0 66 'k', RegExp.$6);
michael@0 67 new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$7",
michael@0 68 'm', RegExp.$7);
michael@0 69 new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$8",
michael@0 70 'o', RegExp.$8);
michael@0 71 new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$9",
michael@0 72 'q', RegExp.$9);
michael@0 73 /*
michael@0 74 new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$10",
michael@0 75 's', RegExp.$10);
michael@0 76 */
michael@0 77 test();

mercurial