Debian Codegraph @

rhino/testsrc/tests/ecma_3/RegExp/regress-223535.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: 24 October 2003
9 * SUMMARY: Testing regexps with empty alternatives
10 *
11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=223535
12 *
13 */
14 //-----------------------------------------------------------------------------
15 var gTestfile = 'regress-223535.js';
16 var i = 0;
17 var BUGNUMBER = 223535;
18 var summary = 'Testing regexps with empty alternatives';
19 var status = '';
20 var statusmessages = new Array();
21 var pattern = '';
22 var patterns = new Array();
23 var string = '';
24 var strings = new Array();
25 var actualmatch = '';
26 var actualmatches = new Array();
27 var expectedmatch = '';
28 var expectedmatches = new Array();
29
30
31 string = 'a';
32 status = inSection(1);
33 pattern = /a|/;
34 actualmatch = string.match(pattern);
35 expectedmatch = Array('a');
36 addThis();
37
38 status = inSection(2);
39 pattern = /|a/;
40 actualmatch = string.match(pattern);
41 expectedmatch = Array('');
42 addThis();
43
44 status = inSection(3);
45 pattern = /|/;
46 actualmatch = string.match(pattern);
47 expectedmatch = Array('');
48 addThis();
49
50 status = inSection(4);
51 pattern = /(a|)/;
52 actualmatch = string.match(pattern);
53 expectedmatch = Array('a', 'a');
54 addThis();
55
56 status = inSection(5);
57 pattern = /(a||)/;
58 actualmatch = string.match(pattern);
59 expectedmatch = Array('a', 'a');
60 addThis();
61
62 status = inSection(6);
63 pattern = /(|a)/;
64 actualmatch = string.match(pattern);
65 expectedmatch = Array('', '');
66 addThis();
67
68 status = inSection(7);
69 pattern = /(|a|)/;
70 actualmatch = string.match(pattern);
71 expectedmatch = Array('', '');
72 addThis();
73
74
75
76 //-------------------------------------------------------------------------------------------------
77 test();
78 //-------------------------------------------------------------------------------------------------
79
80
81
82 function addThis()
83 {
84 statusmessages[i] = status;
85 patterns[i] = pattern;
86 strings[i] = string;
87 actualmatches[i] = actualmatch;
88 expectedmatches[i] = expectedmatch;
89 i++;
90 }
91
92
93 function test()
94 {
95 enterFunc ('test');
96 printBugNumber(BUGNUMBER);
97 printStatus (summary);
98 testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
99 exitFunc ('test');
100 }