~ubuntu-branches/ubuntu/wily/mozjs17/wily

« back to all changes in this revision

Viewing changes to js/src/tests/js1_2/regexp/RegExp_lastParen_as_array.js

  • Committer: Package Import Robot
  • Author(s): Rico Tzschichholz
  • Date: 2013-05-25 12:24:23 UTC
  • Revision ID: package-import@ubuntu.com-20130525122423-zmxucrhtensw90xy
Tags: upstream-17.0.0
ImportĀ upstreamĀ versionĀ 17.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
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 VERSION = 'no version';
 
17
startTest();
 
18
var TITLE   = 'RegExp: $+';
 
19
 
 
20
writeHeaderToLog('Executing script: RegExp_lastParen_as_array.js');
 
21
writeHeaderToLog( SECTION + " "+ TITLE);
 
22
 
 
23
// 'abcd'.match(/(abc)d/); RegExp['$+']
 
24
'abcd'.match(/(abc)d/);
 
25
new TestCase ( SECTION, "'abcd'.match(/(abc)d/); RegExp['$+']",
 
26
               'abc', RegExp['$+']);
 
27
 
 
28
// 'abcd'.match(/(bcd)e/); RegExp['$+']
 
29
'abcd'.match(/(bcd)e/);
 
30
new TestCase ( SECTION, "'abcd'.match(/(bcd)e/); RegExp['$+']",
 
31
               'abc', RegExp['$+']);
 
32
 
 
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['$+']);
 
37
 
 
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['$+']);
 
42
 
 
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['$+']);
 
47
 
 
48
// 'abcdefg'.match(/(^)abc/); RegExp['$+']
 
49
'abcdefg'.match(/(^)abc/);
 
50
new TestCase ( SECTION, "'abcdefg'.match(/(^)abc/); RegExp['$+']",
 
51
               '', RegExp['$+']);
 
52
 
 
53
// 'abcdefg'.match(/(^a)bc/); RegExp['$+']
 
54
'abcdefg'.match(/(^a)bc/);
 
55
new TestCase ( SECTION, "'abcdefg'.match(/(^a)bc/); RegExp['$+']",
 
56
               'a', RegExp['$+']);
 
57
 
 
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['$+']);
 
62
 
 
63
// 'abcdefg'.match(/bc/); RegExp['$+']
 
64
'abcdefg'.match(/bc/);
 
65
new TestCase ( SECTION, "'abcdefg'.match(/bc/); RegExp['$+']",
 
66
               '', RegExp['$+']);
 
67
 
 
68
test();