Debian Codegraph @

rhino/testsrc/tests/js1_2/regexp/RegExp_lastParen.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.js';
7
8 /**
9 Filename: RegExp_lastParen.js
10 Description: 'Tests RegExps lastParen property'
11
12 Author: Nick Lerissa
13 Date: March 12, 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: lastParen';
20
21 writeHeaderToLog('Executing script: RegExp_lastParen.js');
22 writeHeaderToLog( SECTION + " "+ TITLE);
23
24 // 'abcd'.match(/(abc)d/); RegExp.lastParen
25 'abcd'.match(/(abc)d/);
26 new TestCase ( SECTION, "'abcd'.match(/(abc)d/); RegExp.lastParen",
27 'abc', RegExp.lastParen);
28
29 // 'abcd'.match(new RegExp('(abc)d')); RegExp.lastParen
30 'abcd'.match(new RegExp('(abc)d'));
31 new TestCase ( SECTION, "'abcd'.match(new RegExp('(abc)d')); RegExp.lastParen",
32 'abc', RegExp.lastParen);
33
34 // 'abcd'.match(/(bcd)e/); RegExp.lastParen
35 'abcd'.match(/(bcd)e/);
36 new TestCase ( SECTION, "'abcd'.match(/(bcd)e/); RegExp.lastParen",
37 'abc', RegExp.lastParen);
38
39 // 'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp.lastParen
40 'abcdefg'.match(/(a(b(c(d)e)f)g)/);
41 new TestCase ( SECTION, "'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp.lastParen",
42 'd', RegExp.lastParen);
43
44 // 'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp.lastParen
45 'abcdefg'.match(/(a(b)c)(d(e)f)/);
46 new TestCase ( SECTION, "'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp.lastParen",
47 'e', RegExp.lastParen);
48
49 // 'abcdefg'.match(/(^)abc/); RegExp.lastParen
50 'abcdefg'.match(/(^)abc/);
51 new TestCase ( SECTION, "'abcdefg'.match(/(^)abc/); RegExp.lastParen",
52 '', RegExp.lastParen);
53
54 // 'abcdefg'.match(/(^a)bc/); RegExp.lastParen
55 'abcdefg'.match(/(^a)bc/);
56 new TestCase ( SECTION, "'abcdefg'.match(/(^a)bc/); RegExp.lastParen",
57 'a', RegExp.lastParen);
58
59 // 'abcdefg'.match(new RegExp('(^a)bc')); RegExp.lastParen
60 'abcdefg'.match(new RegExp('(^a)bc'));
61 new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(^a)bc')); RegExp.lastParen",
62 'a', RegExp.lastParen);
63
64 // 'abcdefg'.match(/bc/); RegExp.lastParen
65 'abcdefg'.match(/bc/);
66 new TestCase ( SECTION, "'abcdefg'.match(/bc/); RegExp.lastParen",
67 '', RegExp.lastParen);
68
69 test();