]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_2/RegExp/octal-002.js
2 * File Name: RegExp/octal-002.js
4 * Description: Based on ECMA 2 Draft 7 February 1999
5 * Simple test cases for matching OctalEscapeSequences.
6 * Author: christine@netscape.com
7 * Date: 19 February 1999
9 var SECTION
= "RegExp/octal-002.js";
10 var VERSION
= "ECMA_2";
11 var TITLE
= "RegExp patterns that contain OctalEscapeSequences";
12 var BUGNUMBER
="http://scopus/bugsplat/show_bug.cgi?id=346189";
18 /(.)(.)(.)(.)(.)(.)(.)(.)\8/,
19 "/(.)(.)(.)(.)(.)(.)(.)(.)\\8",
23 ["aabbccaaa", "a", "a", "b", "b", "c", "c", "a", "a"] );
26 /(.)(.)(.)(.)(.)(.)(.)(.)(.)\9/,
27 "/(.)(.)(.)(.)(.)(.)(.)(.)\\9",
31 ["aabbccaabb", "a", "a", "b", "b", "c", "c", "a", "a", "b"] );
34 /(.)(.)(.)(.)(.)(.)(.)(.)(.)\8/,
35 "/(.)(.)(.)(.)(.)(.)(.)(.)(.)\\8",
39 ["aabbccaaba", "a", "a", "b", "b", "c", "c", "a", "a", "b"] );
43 function AddRegExpCases(
44 regexp
, str_regexp
, pattern
, str_pattern
, index
, matches_array
) {
46 // prevent a runtime error
48 if ( regexp
.exec(pattern
) == null || matches_array
== null ) {
50 regexp
+ ".exec(" + str_pattern
+")",
52 regexp
.exec(pattern
) );
57 str_regexp
+ ".exec(" + str_pattern
+").length",
59 regexp
.exec(pattern
).length
);
62 str_regexp
+ ".exec(" + str_pattern
+").index",
64 regexp
.exec(pattern
).index
);
67 str_regexp
+ ".exec(" + str_pattern
+").input",
69 regexp
.exec(pattern
).input
);
72 str_regexp
+ ".exec(" + str_pattern
+").toString()",
73 matches_array
.toString(),
74 regexp
.exec(pattern
).toString() );
76 var limit = matches_array.length > regexp.exec(pattern).length
77 ? matches_array.length
78 : regexp.exec(pattern).length;
80 for ( var matches = 0; matches < limit; matches++ ) {
82 str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
83 matches_array[matches],
84 regexp.exec(pattern)[matches] );