Debian Codegraph @

rhino/testsrc/tests/ecma_3/RegExp/regress-123437.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: 04 Feb 2002
9 * SUMMARY: regexp backreferences must hold |undefined| if not used
10 *
11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=123437 (SpiderMonkey)
12 * See http://bugzilla.mozilla.org/show_bug.cgi?id=123439 (Rhino)
13 *
14 */
15 //-----------------------------------------------------------------------------
16 var gTestfile = 'regress-123437.js';
17 var i = 0;
18 var BUGNUMBER = 123437;
19 var summary = 'regexp backreferences must hold |undefined| if not used';
20 var status = '';
21 var statusmessages = new Array();
22 var pattern = '';
23 var patterns = new Array();
24 var string = '';
25 var strings = new Array();
26 var actualmatch = '';
27 var actualmatches = new Array();
28 var expectedmatch = '';
29 var expectedmatches = new Array();
30
31
32 pattern = /(a)?a/;
33 string = 'a';
34 status = inSection(1);
35 actualmatch = string.match(pattern);
36 expectedmatch = Array('a', undefined);
37 addThis();
38
39 pattern = /a|(b)/;
40 string = 'a';
41 status = inSection(2);
42 actualmatch = string.match(pattern);
43 expectedmatch = Array('a', undefined);
44 addThis();
45
46 pattern = /(a)?(a)/;
47 string = 'a';
48 status = inSection(3);
49 actualmatch = string.match(pattern);
50 expectedmatch = Array('a', undefined, 'a');
51 addThis();
52
53
54
55 //-----------------------------------------------------------------------------
56 test();
57 //-----------------------------------------------------------------------------
58
59
60
61 function addThis()
62 {
63 statusmessages[i] = status;
64 patterns[i] = pattern;
65 strings[i] = string;
66 actualmatches[i] = actualmatch;
67 expectedmatches[i] = expectedmatch;
68 i++;
69 }
70
71
72 function test()
73 {
74 enterFunc ('test');
75 printBugNumber(BUGNUMBER);
76 printStatus (summary);
77 testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
78 exitFunc ('test');
79 }