| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
gTestfile = 'octal-003.js'; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
var SECTION = "RegExp/octal-003.js"; |
| 34 |
var VERSION = "ECMA_2"; |
| 35 |
var TITLE = "RegExp patterns that contain OctalEscapeSequences"; |
| 36 |
var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346132"; |
| 37 |
|
| 38 |
startTest(); |
| 39 |
|
| 40 |
AddRegExpCases( /.\011/, "/\\011/", "a" + String.fromCharCode(0) + "11", "a\\011", 0, null ); |
| 41 |
|
| 42 |
test(); |
| 43 |
|
| 44 |
function AddRegExpCases( |
| 45 |
regexp, str_regexp, pattern, str_pattern, index, matches_array ) { |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
if ( regexp.exec(pattern) == null || matches_array == null ) { |
| 50 |
AddTestCase( |
| 51 |
regexp + ".exec(" + str_pattern +")", |
| 52 |
matches_array, |
| 53 |
regexp.exec(pattern) ); |
| 54 |
|
| 55 |
return; |
| 56 |
} |
| 57 |
AddTestCase( |
| 58 |
str_regexp + ".exec(" + str_pattern +").length", |
| 59 |
matches_array.length, |
| 60 |
regexp.exec(pattern).length ); |
| 61 |
|
| 62 |
AddTestCase( |
| 63 |
str_regexp + ".exec(" + str_pattern +").index", |
| 64 |
index, |
| 65 |
regexp.exec(pattern).index ); |
| 66 |
|
| 67 |
AddTestCase( |
| 68 |
str_regexp + ".exec(" + str_pattern +").input", |
| 69 |
escape(pattern), |
| 70 |
escape(regexp.exec(pattern).input) ); |
| 71 |
|
| 72 |
AddTestCase( |
| 73 |
str_regexp + ".exec(" + str_pattern +").toString()", |
| 74 |
matches_array.toString(), |
| 75 |
escape(regexp.exec(pattern).toString()) ); |
| 76 |
|
| 77 |
var limit = matches_array.length > regexp.exec(pattern).length |
| 78 |
? matches_array.length |
| 79 |
: regexp.exec(pattern).length; |
| 80 |
|
| 81 |
for ( var matches = 0; matches < limit; matches++ ) { |
| 82 |
AddTestCase( |
| 83 |
str_regexp + ".exec(" + str_pattern +")[" + matches +"]", |
| 84 |
matches_array[matches], |
| 85 |
escape(regexp.exec(pattern)[matches]) ); |
| 86 |
} |
| 87 |
|
| 88 |
} |