Debian Codegraph @

rhino/testsrc/tests/ecma_3/RegExp/regress-202564.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 /*
7 *
8 * Date: 18 April 2003
9 * SUMMARY: Testing regexp with many backreferences
10 * See http://bugzilla.mozilla.org/show_bug.cgi?id=202564
11 *
12 * Note that in Section 1 below, we expect the 1st and 4th backreferences
13 * to hold |undefined| instead of the empty strings one gets in Perl and IE6.
14 * This is because per ECMA, regexp backreferences must hold |undefined|
15 * if not used. See http://bugzilla.mozilla.org/show_bug.cgi?id=123437.
16 *
17 */
18 //-----------------------------------------------------------------------------
19 var gTestfile = 'regress-202564.js';
20 var i = 0;
21 var BUGNUMBER = 202564;
22 var summary = 'Testing regexp with many backreferences';
23 var status = '';
24 var statusmessages = new Array();
25 var pattern = '';
26 var patterns = new Array();
27 var string = '';
28 var strings = new Array();
29 var actualmatch = '';
30 var actualmatches = new Array();
31 var expectedmatch = '';
32 var expectedmatches = new Array();
33
34
35 status = inSection(1);
36 string = 'Seattle, WA to Buckley, WA';
37 pattern = /(?:(.+), )?(.+), (..) to (?:(.+), )?(.+), (..)/;
38 actualmatch = string.match(pattern);
39 expectedmatch = Array(string, undefined, "Seattle", "WA", undefined, "Buckley", "WA");
40 addThis();
41
42
43
44 //-----------------------------------------------------------------------------
45 test();
46 //-----------------------------------------------------------------------------
47
48
49
50 function addThis()
51 {
52 statusmessages[i] = status;
53 patterns[i] = pattern;
54 strings[i] = string;
55 actualmatches[i] = actualmatch;
56 expectedmatches[i] = expectedmatch;
57 i++;
58 }
59
60
61 function test()
62 {
63 enterFunc ('test');
64 printBugNumber(BUGNUMBER);
65 printStatus (summary);
66 testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
67 exitFunc ('test');
68 }