| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
var gTestfile = 'regress-87231.js'; |
| 28 |
var i = 0; |
| 29 |
var BUGNUMBER = 87231; |
| 30 |
var cnEmptyString = ''; |
| 31 |
var summary = 'Testing regular expression /(A)?(A.*)/'; |
| 32 |
var status = ''; |
| 33 |
var statusmessages = new Array(); |
| 34 |
var pattern = ''; |
| 35 |
var patterns = new Array(); |
| 36 |
var string = ''; |
| 37 |
var strings = new Array(); |
| 38 |
var actualmatch = ''; |
| 39 |
var actualmatches = new Array(); |
| 40 |
var expectedmatch = ''; |
| 41 |
var expectedmatches = new Array(); |
| 42 |
|
| 43 |
|
| 44 |
pattern = /^(A)?(A.*)$/; |
| 45 |
status = inSection(1); |
| 46 |
string = 'AAA'; |
| 47 |
actualmatch = string.match(pattern); |
| 48 |
expectedmatch = Array('AAA', 'A', 'AA'); |
| 49 |
addThis(); |
| 50 |
|
| 51 |
status = inSection(2); |
| 52 |
string = 'AA'; |
| 53 |
actualmatch = string.match(pattern); |
| 54 |
expectedmatch = Array('AA', 'A', 'A'); |
| 55 |
addThis(); |
| 56 |
|
| 57 |
status = inSection(3); |
| 58 |
string = 'A'; |
| 59 |
actualmatch = string.match(pattern); |
| 60 |
expectedmatch = Array('A', undefined, 'A'); |
| 61 |
addThis(); |
| 62 |
|
| 63 |
|
| 64 |
pattern = /(A)?(A.*)/; |
| 65 |
var strL = 'zxcasd;fl\\\ ^'; |
| 66 |
var strR = 'aaAAaaaf;lrlrzs'; |
| 67 |
|
| 68 |
status = inSection(4); |
| 69 |
string = strL + 'AAA' + strR; |
| 70 |
actualmatch = string.match(pattern); |
| 71 |
expectedmatch = Array('AAA' + strR, 'A', 'AA' + strR); |
| 72 |
addThis(); |
| 73 |
|
| 74 |
status = inSection(5); |
| 75 |
string = strL + 'AA' + strR; |
| 76 |
actualmatch = string.match(pattern); |
| 77 |
expectedmatch = Array('AA' + strR, 'A', 'A' + strR); |
| 78 |
addThis(); |
| 79 |
|
| 80 |
status = inSection(6); |
| 81 |
string = strL + 'A' + strR; |
| 82 |
actualmatch = string.match(pattern); |
| 83 |
expectedmatch = Array('A' + strR, undefined, 'A' + strR); |
| 84 |
addThis(); |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
test(); |
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
function addThis() |
| 95 |
{ |
| 96 |
statusmessages[i] = status; |
| 97 |
patterns[i] = pattern; |
| 98 |
strings[i] = string; |
| 99 |
actualmatches[i] = actualmatch; |
| 100 |
expectedmatches[i] = expectedmatch; |
| 101 |
i++; |
| 102 |
} |
| 103 |
|
| 104 |
|
| 105 |
function test() |
| 106 |
{ |
| 107 |
enterFunc ('test'); |
| 108 |
printBugNumber(BUGNUMBER); |
| 109 |
printStatus (summary); |
| 110 |
testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); |
| 111 |
exitFunc ('test'); |
| 112 |
} |