| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
var gTestfile = 'regress-209919.js'; |
| 16 |
var i = 0; |
| 17 |
var BUGNUMBER = 209919; |
| 18 |
var summary = 'Testing regexp submatches with quantifiers'; |
| 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 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
status = inSection(1); |
| 43 |
string = 'a'; |
| 44 |
pattern = /(a|b*)*/; |
| 45 |
actualmatch = string.match(pattern); |
| 46 |
expectedmatch = Array(string, 'a'); |
| 47 |
addThis(); |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
status = inSection(2); |
| 56 |
string = 'a'; |
| 57 |
pattern = /(a|b*){5,}/; |
| 58 |
actualmatch = string.match(pattern); |
| 59 |
expectedmatch = Array(string, ''); |
| 60 |
addThis(); |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
status = inSection(3); |
| 71 |
string = 'a'; |
| 72 |
pattern = /(b*)*/; |
| 73 |
actualmatch = string.match(pattern); |
| 74 |
expectedmatch = Array('', undefined); |
| 75 |
addThis(); |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
status = inSection(4); |
| 84 |
string = 'a'; |
| 85 |
pattern = /(b*)+/; |
| 86 |
actualmatch = string.match(pattern); |
| 87 |
expectedmatch = Array('', ''); |
| 88 |
addThis(); |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
pattern = /^\-?(\d{1,}|\.{0,})*(\,\d{1,})?$/; |
| 95 |
|
| 96 |
status = inSection(5); |
| 97 |
string = '100.00'; |
| 98 |
actualmatch = string.match(pattern); |
| 99 |
expectedmatch = Array(string, '00', undefined); |
| 100 |
addThis(); |
| 101 |
|
| 102 |
status = inSection(6); |
| 103 |
string = '100,00'; |
| 104 |
actualmatch = string.match(pattern); |
| 105 |
expectedmatch = Array(string, '100', ',00'); |
| 106 |
addThis(); |
| 107 |
|
| 108 |
status = inSection(7); |
| 109 |
string = '1.000,00'; |
| 110 |
actualmatch = string.match(pattern); |
| 111 |
expectedmatch = Array(string, '000', ',00'); |
| 112 |
addThis(); |
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
test(); |
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
function addThis() |
| 124 |
{ |
| 125 |
statusmessages[i] = status; |
| 126 |
patterns[i] = pattern; |
| 127 |
strings[i] = string; |
| 128 |
actualmatches[i] = actualmatch; |
| 129 |
expectedmatches[i] = expectedmatch; |
| 130 |
i++; |
| 131 |
} |
| 132 |
|
| 133 |
|
| 134 |
function test() |
| 135 |
{ |
| 136 |
enterFunc ('test'); |
| 137 |
printBugNumber(BUGNUMBER); |
| 138 |
printStatus (summary); |
| 139 |
testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); |
| 140 |
exitFunc ('test'); |
| 141 |
} |