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