]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_2/RegExp/multiline-001.js
2 * File Name: RegExp/multiline-001.js
4 * Description: Based on ECMA 2 Draft 7 February 1999
6 * Date: 19 February 1999
9 var SECTION
= "RegExp/multiline-001";
10 var VERSION
= "ECMA_2";
11 var TITLE
= "RegExp: multiline flag";
12 var BUGNUMBER
="343901";
16 var woodpeckers
= "ivory-billed\ndowny\nhairy\nacorn\nyellow-bellied sapsucker\n" +
17 "northern flicker\npileated\n";
19 AddRegExpCases( /.*[y]$/m, woodpeckers
, woodpeckers
.indexOf("downy"), ["downy"] );
21 AddRegExpCases( /.*[d]$/m, woodpeckers
, woodpeckers
.indexOf("ivory-billed"), ["ivory-billed"] );
26 function AddRegExpCases
27 ( regexp
, pattern
, index
, matches_array
) {
29 // prevent a runtime error
31 if ( regexp
.exec(pattern
) == null || matches_array
== null ) {
33 regexp
+ ".exec(" + pattern
+")",
35 regexp
.exec(pattern
) );
41 regexp
.toString() + ".exec(" + pattern
+").length",
43 regexp
.exec(pattern
).length
);
46 regexp
.toString() + ".exec(" + pattern
+").index",
48 regexp
.exec(pattern
).index
);
51 regexp
+ ".exec(" + pattern
+").input",
53 regexp
.exec(pattern
).input
);
56 for ( var matches
= 0; matches
< matches_array
.length
; matches
++ ) {
58 regexp
+ ".exec(" + pattern
+")[" + matches
+"]",
59 matches_array
[matches
],
60 regexp
.exec(pattern
)[matches
] );