Debian Codegraph @

rhino/testsrc/tests/js1_2/regexp/RegExp_lastParen_as_array.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_lastParen_as_array.js';
7
8 /**
9 Filename: RegExp_lastParen_as_array.js
10 Description: 'Tests RegExps $+ property (same tests as RegExp_lastParen.js but using $+)'
11
12 Author: Nick Lerissa
13 Date: March 13, 1998
14 */
15
16 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
17 var VERSION = 'no version';
18 startTest();
19 var TITLE = 'RegExp: $+';
20
21 writeHeaderToLog('Executing script: RegExp_lastParen_as_array.js');
22 writeHeaderToLog( SECTION + " "+ TITLE);
23
24 // 'abcd'.match(/(abc)d/); RegExp['$+']
25 'abcd'.match(/(abc)d/);
26 new TestCase ( SECTION, "'abcd'.match(/(abc)d/); RegExp['$+']",
27 'abc', RegExp['$+']);
28
29 // 'abcd'.match(/(bcd)e/); RegExp['$+']
30 'abcd'.match(/(bcd)e/);
31 new TestCase ( SECTION, "'abcd'.match(/(bcd)e/); RegExp['$+']",
32 'abc', RegExp['$+']);
33
34 // 'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp['$+']
35 'abcdefg'.match(/(a(b(c(d)e)f)g)/);
36 new TestCase ( SECTION, "'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp['$+']",
37 'd', RegExp['$+']);
38
39 // 'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)')); RegExp['$+']
40 'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)'));
41 new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)')); RegExp['$+']",
42 'd', RegExp['$+']);
43
44 // 'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp['$+']
45 'abcdefg'.match(/(a(b)c)(d(e)f)/);
46 new TestCase ( SECTION, "'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp['$+']",
47 'e', RegExp['$+']);
48
49 // 'abcdefg'.match(/(^)abc/); RegExp['$+']
50 'abcdefg'.match(/(^)abc/);
51 new TestCase ( SECTION, "'abcdefg'.match(/(^)abc/); RegExp['$+']",
52 '', RegExp['$+']);
53
54 // 'abcdefg'.match(/(^a)bc/); RegExp['$+']
55 'abcdefg'.match(/(^a)bc/);
56 new TestCase ( SECTION, "'abcdefg'.match(/(^a)bc/); RegExp['$+']",
57 'a', RegExp['$+']);
58
59 // 'abcdefg'.match(new RegExp('(^a)bc')); RegExp['$+']
60 'abcdefg'.match(new RegExp('(^a)bc'));
61 new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(^a)bc')); RegExp['$+']",
62 'a', RegExp['$+']);
63
64 // 'abcdefg'.match(/bc/); RegExp['$+']
65 'abcdefg'.match(/bc/);
66 new TestCase ( SECTION, "'abcdefg'.match(/bc/); RegExp['$+']",
67 '', RegExp['$+']);
68
69 test();