Debian Codegraph @

rhino/testsrc/tests/js1_2/regexp/RegExp_lastMatch.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_lastMatch.js';
7
8 /**
9 Filename: RegExp_lastMatch.js
10 Description: 'Tests RegExps lastMatch 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: lastMatch';
20
21 writeHeaderToLog('Executing script: RegExp_lastMatch.js');
22 writeHeaderToLog( SECTION + " "+ TITLE);
23
24
25 // 'foo'.match(/foo/); RegExp.lastMatch
26 'foo'.match(/foo/);
27 new TestCase ( SECTION, "'foo'.match(/foo/); RegExp.lastMatch",
28 'foo', RegExp.lastMatch);
29
30 // 'foo'.match(new RegExp('foo')); RegExp.lastMatch
31 'foo'.match(new RegExp('foo'));
32 new TestCase ( SECTION, "'foo'.match(new RegExp('foo')); RegExp.lastMatch",
33 'foo', RegExp.lastMatch);
34
35 // 'xxx'.match(/bar/); RegExp.lastMatch
36 'xxx'.match(/bar/);
37 new TestCase ( SECTION, "'xxx'.match(/bar/); RegExp.lastMatch",
38 'foo', RegExp.lastMatch);
39
40 // 'xxx'.match(/$/); RegExp.lastMatch
41 'xxx'.match(/$/);
42 new TestCase ( SECTION, "'xxx'.match(/$/); RegExp.lastMatch",
43 '', RegExp.lastMatch);
44
45 // 'abcdefg'.match(/^..(cd)[a-z]+/); RegExp.lastMatch
46 'abcdefg'.match(/^..(cd)[a-z]+/);
47 new TestCase ( SECTION, "'abcdefg'.match(/^..(cd)[a-z]+/); RegExp.lastMatch",
48 'abcdefg', RegExp.lastMatch);
49
50 // 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/); RegExp.lastMatch
51 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/);
52 new TestCase ( SECTION, "'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\\1/); RegExp.lastMatch",
53 'abcdefgabcdefg', RegExp.lastMatch);
54
55 test();