|
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/. */ |
|
5 |
|
6 |
|
7 /** |
|
8 Filename: RegExp_dollar_number.js |
|
9 Description: 'Tests RegExps $1, ..., $9 properties' |
|
10 |
|
11 Author: Nick Lerissa |
|
12 Date: March 12, 1998 |
|
13 */ |
|
14 |
|
15 var SECTION = 'As described in Netscape doc "What\'s new in JavaScript 1.2"'; |
|
16 var VERSION = 'no version'; |
|
17 var TITLE = 'RegExp: $1, ..., $9'; |
|
18 var BUGNUMBER="123802"; |
|
19 |
|
20 startTest(); |
|
21 writeHeaderToLog('Executing script: RegExp_dollar_number.js'); |
|
22 writeHeaderToLog( SECTION + " "+ TITLE); |
|
23 |
|
24 |
|
25 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$1 |
|
26 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); |
|
27 new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$1", |
|
28 'abcdefghi', RegExp.$1); |
|
29 |
|
30 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$2 |
|
31 new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$2", |
|
32 'bcdefgh', RegExp.$2); |
|
33 |
|
34 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$3 |
|
35 new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$3", |
|
36 'cdefg', RegExp.$3); |
|
37 |
|
38 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$4 |
|
39 new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$4", |
|
40 'def', RegExp.$4); |
|
41 |
|
42 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$5 |
|
43 new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$5", |
|
44 'e', RegExp.$5); |
|
45 |
|
46 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$6 |
|
47 new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$6", |
|
48 '', RegExp.$6); |
|
49 |
|
50 var a_to_z = 'abcdefghijklmnopqrstuvwxyz'; |
|
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/ |
|
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 |
|
53 a_to_z.match(regexp1); |
|
54 |
|
55 new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$1", |
|
56 'a', RegExp.$1); |
|
57 new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$2", |
|
58 'c', RegExp.$2); |
|
59 new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$3", |
|
60 'e', RegExp.$3); |
|
61 new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$4", |
|
62 'g', RegExp.$4); |
|
63 new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$5", |
|
64 'i', RegExp.$5); |
|
65 new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$6", |
|
66 'k', RegExp.$6); |
|
67 new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$7", |
|
68 'm', RegExp.$7); |
|
69 new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$8", |
|
70 'o', RegExp.$8); |
|
71 new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$9", |
|
72 'q', RegExp.$9); |
|
73 /* |
|
74 new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$10", |
|
75 's', RegExp.$10); |
|
76 */ |
|
77 test(); |