| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
var gTestfile = 'regress-123437.js'; |
| 17 |
var i = 0; |
| 18 |
var BUGNUMBER = 123437; |
| 19 |
var summary = 'regexp backreferences must hold |undefined| if not used'; |
| 20 |
var status = ''; |
| 21 |
var statusmessages = new Array(); |
| 22 |
var pattern = ''; |
| 23 |
var patterns = new Array(); |
| 24 |
var string = ''; |
| 25 |
var strings = new Array(); |
| 26 |
var actualmatch = ''; |
| 27 |
var actualmatches = new Array(); |
| 28 |
var expectedmatch = ''; |
| 29 |
var expectedmatches = new Array(); |
| 30 |
|
| 31 |
|
| 32 |
pattern = /(a)?a/; |
| 33 |
string = 'a'; |
| 34 |
status = inSection(1); |
| 35 |
actualmatch = string.match(pattern); |
| 36 |
expectedmatch = Array('a', undefined); |
| 37 |
addThis(); |
| 38 |
|
| 39 |
pattern = /a|(b)/; |
| 40 |
string = 'a'; |
| 41 |
status = inSection(2); |
| 42 |
actualmatch = string.match(pattern); |
| 43 |
expectedmatch = Array('a', undefined); |
| 44 |
addThis(); |
| 45 |
|
| 46 |
pattern = /(a)?(a)/; |
| 47 |
string = 'a'; |
| 48 |
status = inSection(3); |
| 49 |
actualmatch = string.match(pattern); |
| 50 |
expectedmatch = Array('a', undefined, 'a'); |
| 51 |
addThis(); |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
test(); |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
function addThis() |
| 62 |
{ |
| 63 |
statusmessages[i] = status; |
| 64 |
patterns[i] = pattern; |
| 65 |
strings[i] = string; |
| 66 |
actualmatches[i] = actualmatch; |
| 67 |
expectedmatches[i] = expectedmatch; |
| 68 |
i++; |
| 69 |
} |
| 70 |
|
| 71 |
|
| 72 |
function test() |
| 73 |
{ |
| 74 |
enterFunc ('test'); |
| 75 |
printBugNumber(BUGNUMBER); |
| 76 |
printStatus (summary); |
| 77 |
testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); |
| 78 |
exitFunc ('test'); |
| 79 |
} |