Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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/. */
7 /**
8 Filename: RegExp_lastParen_as_array.js
9 Description: 'Tests RegExps $+ property (same tests as RegExp_lastParen.js but using $+)'
11 Author: Nick Lerissa
12 Date: March 13, 1998
13 */
15 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
16 var VERSION = 'no version';
17 startTest();
18 var TITLE = 'RegExp: $+';
20 writeHeaderToLog('Executing script: RegExp_lastParen_as_array.js');
21 writeHeaderToLog( SECTION + " "+ TITLE);
23 // 'abcd'.match(/(abc)d/); RegExp['$+']
24 'abcd'.match(/(abc)d/);
25 new TestCase ( SECTION, "'abcd'.match(/(abc)d/); RegExp['$+']",
26 'abc', RegExp['$+']);
28 // 'abcd'.match(/(bcd)e/); RegExp['$+']
29 'abcd'.match(/(bcd)e/);
30 new TestCase ( SECTION, "'abcd'.match(/(bcd)e/); RegExp['$+']",
31 'abc', RegExp['$+']);
33 // 'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp['$+']
34 'abcdefg'.match(/(a(b(c(d)e)f)g)/);
35 new TestCase ( SECTION, "'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp['$+']",
36 'd', RegExp['$+']);
38 // 'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)')); RegExp['$+']
39 'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)'));
40 new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)')); RegExp['$+']",
41 'd', RegExp['$+']);
43 // 'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp['$+']
44 'abcdefg'.match(/(a(b)c)(d(e)f)/);
45 new TestCase ( SECTION, "'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp['$+']",
46 'e', RegExp['$+']);
48 // 'abcdefg'.match(/(^)abc/); RegExp['$+']
49 'abcdefg'.match(/(^)abc/);
50 new TestCase ( SECTION, "'abcdefg'.match(/(^)abc/); RegExp['$+']",
51 '', RegExp['$+']);
53 // 'abcdefg'.match(/(^a)bc/); RegExp['$+']
54 'abcdefg'.match(/(^a)bc/);
55 new TestCase ( SECTION, "'abcdefg'.match(/(^a)bc/); RegExp['$+']",
56 'a', RegExp['$+']);
58 // 'abcdefg'.match(new RegExp('(^a)bc')); RegExp['$+']
59 'abcdefg'.match(new RegExp('(^a)bc'));
60 new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(^a)bc')); RegExp['$+']",
61 'a', RegExp['$+']);
63 // 'abcdefg'.match(/bc/); RegExp['$+']
64 'abcdefg'.match(/bc/);
65 new TestCase ( SECTION, "'abcdefg'.match(/bc/); RegExp['$+']",
66 '', RegExp['$+']);
68 test();