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