| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
var gTestfile = 'regress-223535.js'; |
| 16 |
var i = 0; |
| 17 |
var BUGNUMBER = 223535; |
| 18 |
var summary = 'Testing regexps with empty alternatives'; |
| 19 |
var status = ''; |
| 20 |
var statusmessages = new Array(); |
| 21 |
var pattern = ''; |
| 22 |
var patterns = new Array(); |
| 23 |
var string = ''; |
| 24 |
var strings = new Array(); |
| 25 |
var actualmatch = ''; |
| 26 |
var actualmatches = new Array(); |
| 27 |
var expectedmatch = ''; |
| 28 |
var expectedmatches = new Array(); |
| 29 |
|
| 30 |
|
| 31 |
string = 'a'; |
| 32 |
status = inSection(1); |
| 33 |
pattern = /a|/; |
| 34 |
actualmatch = string.match(pattern); |
| 35 |
expectedmatch = Array('a'); |
| 36 |
addThis(); |
| 37 |
|
| 38 |
status = inSection(2); |
| 39 |
pattern = /|a/; |
| 40 |
actualmatch = string.match(pattern); |
| 41 |
expectedmatch = Array(''); |
| 42 |
addThis(); |
| 43 |
|
| 44 |
status = inSection(3); |
| 45 |
pattern = /|/; |
| 46 |
actualmatch = string.match(pattern); |
| 47 |
expectedmatch = Array(''); |
| 48 |
addThis(); |
| 49 |
|
| 50 |
status = inSection(4); |
| 51 |
pattern = /(a|)/; |
| 52 |
actualmatch = string.match(pattern); |
| 53 |
expectedmatch = Array('a', 'a'); |
| 54 |
addThis(); |
| 55 |
|
| 56 |
status = inSection(5); |
| 57 |
pattern = /(a||)/; |
| 58 |
actualmatch = string.match(pattern); |
| 59 |
expectedmatch = Array('a', 'a'); |
| 60 |
addThis(); |
| 61 |
|
| 62 |
status = inSection(6); |
| 63 |
pattern = /(|a)/; |
| 64 |
actualmatch = string.match(pattern); |
| 65 |
expectedmatch = Array('', ''); |
| 66 |
addThis(); |
| 67 |
|
| 68 |
status = inSection(7); |
| 69 |
pattern = /(|a|)/; |
| 70 |
actualmatch = string.match(pattern); |
| 71 |
expectedmatch = Array('', ''); |
| 72 |
addThis(); |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
test(); |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
function addThis() |
| 83 |
{ |
| 84 |
statusmessages[i] = status; |
| 85 |
patterns[i] = pattern; |
| 86 |
strings[i] = string; |
| 87 |
actualmatches[i] = actualmatch; |
| 88 |
expectedmatches[i] = expectedmatch; |
| 89 |
i++; |
| 90 |
} |
| 91 |
|
| 92 |
|
| 93 |
function test() |
| 94 |
{ |
| 95 |
enterFunc ('test'); |
| 96 |
printBugNumber(BUGNUMBER); |
| 97 |
printStatus (summary); |
| 98 |
testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); |
| 99 |
exitFunc ('test'); |
| 100 |
} |