]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_3/RegExp/regress-100199.js
2 * The contents of this file are subject to the Netscape Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/NPL/
7 * Software distributed under the License is distributed on an "AS IS"
8 * basis, WITHOUT WARRANTY OF ANY KIND, either expressed
9 * or implied. See the License for the specific language governing
10 * rights and limitations under the License.
12 * The Original Code is mozilla.org code.
14 * The Initial Developer of the Original Code is Netscape
15 * Communications Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation.
17 * All Rights Reserved.
19 * Contributor(s): pschwartau@netscape.com
20 * Date: 17 September 2001
22 * SUMMARY: Regression test for Bugzilla bug 100199
23 * See http://bugzilla.mozilla.org/show_bug.cgi?id=100199
25 * The empty character class [] is a valid RegExp construct: the condition
26 * that a given character belong to a set containing no characters. As such,
27 * it can never be met and is always FALSE. Similarly, [^] is a condition
28 * that matches any given character and is always TRUE.
30 * Neither one of these conditions should cause syntax errors in a RegExp.
32 //-----------------------------------------------------------------------------
35 var summary
= '[], [^] are valid RegExp conditions. Should not cause errors -';
37 var statusmessages
= new Array();
39 var patterns
= new Array();
41 var strings
= new Array();
43 var actualmatches
= new Array();
44 var expectedmatch
= '';
45 var expectedmatches
= new Array();
50 status
= inSection(1);
51 actualmatch
= string
.match(pattern
);
56 status
= inSection(2);
57 actualmatch
= string
.match(pattern
);
62 status
= inSection(3);
63 actualmatch
= string
.match(pattern
);
68 status
= inSection(4);
69 actualmatch
= string
.match(pattern
);
74 status
= inSection(5);
75 actualmatch
= string
.match(pattern
);
80 status
= inSection(6);
81 actualmatch
= string
.match(pattern
);
86 status
= inSection(7);
87 actualmatch
= string
.match(pattern
);
92 status
= inSection(8);
93 actualmatch
= string
.match(pattern
);
98 status
= inSection(9);
99 actualmatch
= string
.match(pattern
);
100 expectedmatch
= null;
106 status
= inSection(10);
107 actualmatch
= string
.match(pattern
);
108 expectedmatch
= null;
112 status
= inSection(11);
113 actualmatch
= string
.match(pattern
);
114 expectedmatch
= null;
118 status
= inSection(12);
119 actualmatch
= string
.match(pattern
);
120 expectedmatch
= null;
124 status
= inSection(13);
125 actualmatch
= string
.match(pattern
);
126 expectedmatch
= null;
130 status
= inSection(14);
131 actualmatch
= string
.match(pattern
);
132 expectedmatch
= null;
136 status
= inSection(15);
137 actualmatch
= string
.match(pattern
);
138 expectedmatch
= null;
142 status
= inSection(16);
143 actualmatch
= string
.match(pattern
);
144 expectedmatch
= null;
148 status
= inSection(17);
149 actualmatch
= string
.match(pattern
);
150 expectedmatch
= null;
154 status
= inSection(18);
155 actualmatch
= string
.match(pattern
);
156 expectedmatch
= null;
162 status
= inSection(19);
163 actualmatch
= string
.match(pattern
);
164 expectedmatch
= Array('a');
168 status
= inSection(20);
169 actualmatch
= string
.match(pattern
);
170 expectedmatch
= null; //there are no characters to test against the condition
174 status
= inSection(21);
175 actualmatch
= string
.match(pattern
);
176 expectedmatch
= Array('/');
180 status
= inSection(22);
181 actualmatch
= string
.match(pattern
);
182 expectedmatch
= Array('[');
186 status
= inSection(23);
187 actualmatch
= string
.match(pattern
);
188 expectedmatch
= Array('[');
192 status
= inSection(24);
193 actualmatch
= string
.match(pattern
);
194 expectedmatch
= Array(']');
198 status
= inSection(25);
199 actualmatch
= string
.match(pattern
);
200 expectedmatch
= Array('[');
204 status
= inSection(26);
205 actualmatch
= string
.match(pattern
);
206 expectedmatch
= Array('[');
210 status
= inSection(27);
211 actualmatch
= string
.match(pattern
);
212 expectedmatch
= Array(']');
218 status
= inSection(28);
219 actualmatch
= string
.match(pattern
);
220 expectedmatch
= Array('ab');
224 status
= inSection(29);
225 actualmatch
= string
.match(pattern
);
226 expectedmatch
= null; //there are no characters to test against the condition
230 status
= inSection(30);
231 actualmatch
= string
.match(pattern
);
232 expectedmatch
= Array('a[');
236 status
= inSection(31);
237 actualmatch
= string
.match(pattern
);
238 expectedmatch
= Array('a]');
242 status
= inSection(32);
243 actualmatch
= string
.match(pattern
);
244 expectedmatch
= Array('a[');
248 status
= inSection(33);
249 actualmatch
= string
.match(pattern
);
250 expectedmatch
= Array('a[');
254 status
= inSection(34);
255 actualmatch
= string
.match(pattern
);
256 expectedmatch
= Array('a]');
262 //-----------------------------------------------------------------------------
264 //-----------------------------------------------------------------------------
270 statusmessages
[i
] = status
;
271 patterns
[i
] = pattern
;
273 actualmatches
[i
] = actualmatch
;
274 expectedmatches
[i
] = expectedmatch
;
282 printBugNumber (bug
);
283 printStatus (summary
);
284 testRegExp(statusmessages
, patterns
, strings
, actualmatches
, expectedmatches
);