Debian Codegraph @

rhino/testsrc/tests/js1_2/regexp/RegExp_dollar_number.js

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