|
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 * File Name: RegExp/regress-001.js |
|
9 * ECMA Section: N/A |
|
10 * Description: Regression test case: |
|
11 * JS regexp anchoring on empty match bug |
|
12 * http://bugzilla.mozilla.org/show_bug.cgi?id=2157 |
|
13 * |
|
14 * Author: christine@netscape.com |
|
15 * Date: 19 February 1999 |
|
16 */ |
|
17 var SECTION = "RegExp/hex-001.js"; |
|
18 var VERSION = "ECMA_2"; |
|
19 var TITLE = "JS regexp anchoring on empty match bug"; |
|
20 var BUGNUMBER = "2157"; |
|
21 |
|
22 startTest(); |
|
23 |
|
24 AddRegExpCases( /a||b/.exec(''), |
|
25 "/a||b/.exec('')", |
|
26 1, |
|
27 [''] ); |
|
28 |
|
29 test(); |
|
30 |
|
31 function AddRegExpCases( regexp, str_regexp, length, matches_array ) { |
|
32 |
|
33 AddTestCase( |
|
34 "( " + str_regexp + " ).length", |
|
35 regexp.length, |
|
36 regexp.length ); |
|
37 |
|
38 |
|
39 for ( var matches = 0; matches < matches_array.length; matches++ ) { |
|
40 AddTestCase( |
|
41 "( " + str_regexp + " )[" + matches +"]", |
|
42 matches_array[matches], |
|
43 regexp[matches] ); |
|
44 } |
|
45 } |