From 6333005ace7e1b5dbe04bf2656ffd5389ed42def Mon Sep 17 00:00:00 2001 From: "pschwartau%netscape.com" Date: Fri, 14 Sep 2001 00:29:21 +0000 Subject: [PATCH] Making testcase compatible with updated testRegExp() function in utility file shell.js --- js/tests/ecma_3/RegExp/regress-31316.js | 6 ++++- js/tests/ecma_3/RegExp/regress-57572.js | 27 ++++++++++++++++---- js/tests/ecma_3/RegExp/regress-67773.js | 34 +++++++++++++++++++++---- js/tests/ecma_3/RegExp/regress-72964.js | 22 ++++++++++++---- js/tests/ecma_3/RegExp/regress-76683.js | 8 +++++- js/tests/ecma_3/RegExp/regress-78156.js | 9 ++++++- js/tests/ecma_3/RegExp/regress-87231.js | 11 +++++++- 7 files changed, 98 insertions(+), 19 deletions(-) diff --git a/js/tests/ecma_3/RegExp/regress-31316.js b/js/tests/ecma_3/RegExp/regress-31316.js index 90c583c26382..350ef1afd926 100644 --- a/js/tests/ecma_3/RegExp/regress-31316.js +++ b/js/tests/ecma_3/RegExp/regress-31316.js @@ -29,6 +29,8 @@ var i = 0; var bug = 31316; var summary = 'Regression test for Bugzilla bug 31316'; var cnEmptyString = ''; +var status = ''; +var statusmessages = new Array(); var pattern = ''; var patterns = new Array(); var string = ''; @@ -39,6 +41,7 @@ var expectedmatch = ''; var expectedmatches = new Array(); +status = inSection(1); pattern = /<([^\/<>][^<>]*[^\/])>|<([^\/<>])>/; string = '

Some
test

'; actualmatch = string.match(pattern); @@ -53,6 +56,7 @@ test(); function addThis() { + statusmessages[i] = status; patterns[i] = pattern; strings[i] = string; actualmatches[i] = actualmatch; @@ -66,6 +70,6 @@ function test() enterFunc ('test'); printBugNumber (bug); printStatus (summary); - testRegExp(patterns, strings, actualmatches, expectedmatches); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); exitFunc ('test'); } diff --git a/js/tests/ecma_3/RegExp/regress-57572.js b/js/tests/ecma_3/RegExp/regress-57572.js index ad63c41b4191..8b766e4f3098 100644 --- a/js/tests/ecma_3/RegExp/regress-57572.js +++ b/js/tests/ecma_3/RegExp/regress-57572.js @@ -29,61 +29,77 @@ var i = 0; var bug = 57572; var summary = 'Testing regular expressions containing "?"\n'; var cnEmptyString = ''; var cnSingleSpace = ' '; -var pattern = ''; var patterns = new Array(); -var string = ''; var strings = new Array(); -var actualmatch = ''; var actualmatches = new Array(); -var expectedmatch = ''; var expectedmatches = new Array(); +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); +status = inSection(1); pattern = /(\S+)?(.*)/; string = 'Test this'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'Test', ' this'); //single space in front of 'this' addThis(); +status = inSection(2); pattern = /(\S+)? ?(.*)/; //single space between the ? characters string= 'Test this'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'Test', 'this'); //NO space in front of 'this' addThis(); +status = inSection(3); pattern = /(\S+)????(.*)/; string= 'Test this'; actualmatch = string.match(pattern); expectedmatch = Array(string, cnEmptyString, string); addThis(); +status = inSection(4); pattern = /(\S+)?(.*)/; string = 'Stupid phrase, with six - (short) words'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'Stupid', ' phrase, with six - (short) words'); //single space in front of 'phrase' addThis(); +status = inSection(5); pattern = /(\S+)? ?(.*)/; //single space between the ? characters string = 'Stupid phrase, with six - (short) words'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'Stupid', 'phrase, with six - (short) words'); //NO space in front of 'phrase' addThis(); + // let's add an extra back-reference this time - three instead of two - +status = inSection(6); pattern = /(\S+)?( ?)(.*)/; //single space before second ? character string = 'Stupid phrase, with six - (short) words'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'Stupid', cnSingleSpace, 'phrase, with six - (short) words'); addThis(); +status = inSection(7); pattern = /^(\S+)?( ?)(B+)$/; //single space before second ? character string = 'AAABBB'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'AAABB', cnEmptyString, 'B'); addThis(); +status = inSection(8); pattern = /(\S+)?(!?)(.*)/; string = 'WOW !!! !!!'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'WOW', cnEmptyString, ' !!! !!!'); addThis(); +status = inSection(9); pattern = /(.+)?(!?)(!+)/; string = 'WOW !!! !!!'; actualmatch = string.match(pattern); @@ -100,6 +116,7 @@ test(); function addThis() { + statusmessages[i] = status; patterns[i] = pattern; strings[i] = string; actualmatches[i] = actualmatch; @@ -113,6 +130,6 @@ function test() enterFunc ('test'); printBugNumber (bug); printStatus (summary); - testRegExp(patterns, strings, actualmatches, expectedmatches); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); exitFunc ('test'); } diff --git a/js/tests/ecma_3/RegExp/regress-67773.js b/js/tests/ecma_3/RegExp/regress-67773.js index 453da911a168..e3990507384f 100644 --- a/js/tests/ecma_3/RegExp/regress-67773.js +++ b/js/tests/ecma_3/RegExp/regress-67773.js @@ -30,23 +30,32 @@ var i = 0; var bug = 67773; var summary = 'Testing regular subexpressions followed by ? or +\n'; var cnSingleSpace = ' '; -var pattern = ''; var patterns = new Array(); -var string = ''; var strings = new Array(); -var actualmatch = ''; var actualmatches = new Array(); -var expectedmatch = ''; var expectedmatches = new Array(); +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); pattern = /^(\S+)?( ?)(B+)$/; //single space before second ? character + status = inSection(1); string = 'AAABBB AAABBB '; //single space at middle and at end - actualmatch = string.match(pattern); expectedmatch = null; addThis(); + status = inSection(2); string = 'AAABBB BBB'; //single space in the middle actualmatch = string.match(pattern); expectedmatch = Array(string, 'AAABBB', cnSingleSpace, 'BBB'); addThis(); + status = inSection(3); string = 'AAABBB AAABBB'; //single space in the middle actualmatch = string.match(pattern); expectedmatch = null; @@ -54,21 +63,25 @@ pattern = /^(\S+)?( ?)(B+)$/; //single space before second ? character pattern = /^(A+B)+$/; + status = inSection(4); string = 'AABAAB'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'AAB'); addThis(); + status = inSection(5); string = 'ABAABAAAAAAB'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'AAAAAAB'); addThis(); + status = inSection(6); string = 'ABAABAABAB'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'AB'); addThis(); + status = inSection(7); string = 'ABAABAABABB'; actualmatch = string.match(pattern); expectedmatch = null; // because string doesn't match at end @@ -76,6 +89,7 @@ pattern = /^(A+B)+$/; pattern = /^(A+1)+$/; + status = inSection(8); string = 'AA1AA1'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'AA1'); @@ -83,21 +97,25 @@ pattern = /^(A+1)+$/; pattern = /^(\w+\-)+$/; + status = inSection(9); string = ''; actualmatch = string.match(pattern); expectedmatch = null; addThis(); + status = inSection(10); string = 'bla-'; actualmatch = string.match(pattern); expectedmatch = Array(string, string); addThis(); + status = inSection(11); string = 'bla-bla'; // hyphen missing at end - actualmatch = string.match(pattern); expectedmatch = null; //because string doesn't match at end addThis(); + status = inSection(12); string = 'bla-bla-'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'bla-'); @@ -105,11 +123,13 @@ pattern = /^(\w+\-)+$/; pattern = /^(\S+)+(A+)$/; + status = inSection(13); string = 'asdldflkjAAA'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'asdldflkjAA', 'A'); addThis(); + status = inSection(14); string = 'asdldflkj AAA'; // space in middle actualmatch = string.match(pattern); expectedmatch = null; //because of the space @@ -117,11 +137,13 @@ pattern = /^(\S+)+(A+)$/; pattern = /^(\S+)+(\d+)$/; + status = inSection(15); string = 'asdldflkj122211'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'asdldflkj12221', '1'); addThis(); + status = inSection(16); string = 'asdldflkj1111111aaa1'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'asdldflkj1111111aaa', '1'); @@ -133,6 +155,7 @@ pattern = /^(\S+)+(\d+)$/; * See http://bugzilla.mozilla.org/show_bug.cgi?id=69989 */ pattern = /^[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)+$/; + status = inSection(17); string = 'some.host.tld'; actualmatch = string.match(pattern); expectedmatch = Array(string, '.tld', '.'); @@ -148,6 +171,7 @@ test(); function addThis() { + statusmessages[i] = status; patterns[i] = pattern; strings[i] = string; actualmatches[i] = actualmatch; @@ -161,6 +185,6 @@ function test() enterFunc ('test'); printBugNumber (bug); printStatus (summary); - testRegExp(patterns, strings, actualmatches, expectedmatches); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); exitFunc ('test'); } diff --git a/js/tests/ecma_3/RegExp/regress-72964.js b/js/tests/ecma_3/RegExp/regress-72964.js index 20413f151e4d..596531313b54 100644 --- a/js/tests/ecma_3/RegExp/regress-72964.js +++ b/js/tests/ecma_3/RegExp/regress-72964.js @@ -29,32 +29,43 @@ var i = 0; var bug = 72964; var summary = 'Testing regular expressions containing non-Latin1 characters'; var cnSingleSpace = ' '; -var pattern = ''; var patterns = new Array(); -var string = ''; var strings = new Array(); -var actualmatch = ''; var actualmatches = new Array(); -var expectedmatch = ''; var expectedmatches = new Array(); +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); pattern = /[\S]+/; // 4 low Unicode chars = Latin1; whole string should match + status = inSection(1); string = '\u00BF\u00CD\u00BB\u00A7'; actualmatch = string.match(pattern); expectedmatch = Array(string); addThis(); // Now put a space in the middle; first half of string should match + status = inSection(2); string = '\u00BF\u00CD \u00BB\u00A7'; actualmatch = string.match(pattern); expectedmatch = Array('\u00BF\u00CD'); addThis(); + // 4 high Unicode chars = non-Latin1; whole string should match + status = inSection(3); string = '\u4e00\uac00\u4e03\u4e00'; actualmatch = string.match(pattern); expectedmatch = Array(string); addThis(); // Now put a space in the middle; first half of string should match + status = inSection(4); string = '\u4e00\uac00 \u4e03\u4e00'; actualmatch = string.match(pattern); expectedmatch = Array('\u4e00\uac00'); @@ -70,6 +81,7 @@ test(); function addThis() { + statusmessages[i] = status; patterns[i] = pattern; strings[i] = string; actualmatches[i] = actualmatch; @@ -83,6 +95,6 @@ function test() enterFunc ('test'); printBugNumber (bug); printStatus (summary); - testRegExp(patterns, strings, actualmatches, expectedmatches); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); exitFunc ('test'); } diff --git a/js/tests/ecma_3/RegExp/regress-76683.js b/js/tests/ecma_3/RegExp/regress-76683.js index bbe3366972d2..59b95b973a00 100644 --- a/js/tests/ecma_3/RegExp/regress-76683.js +++ b/js/tests/ecma_3/RegExp/regress-76683.js @@ -28,6 +28,8 @@ var i = 0; var bug = 76683; var summary = 'Regression test for Bugzilla bug 76683'; +var status = ''; +var statusmessages = new Array(); var pattern = ''; var patterns = new Array(); var string = ''; @@ -43,17 +45,20 @@ var expectedmatches = new Array(); * It didn't matter what the string was. No problem in SpiderMonkey - */ string = 'abc'; + status = inSection(1); pattern = /()|(<([\$\w:\.\-]+)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))/; actualmatch = string.match(pattern); expectedmatch = null; addThis(); + status = inSection(2); pattern = /()|(<(tagPattern)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))/; actualmatch = string.match(pattern); expectedmatch = null; addThis(); // This was the one causing a Rhino crash - + status = inSection(3); pattern = /()|(<(tagPattern)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))|(<\/tagPattern[^>]*>)/; actualmatch = string.match(pattern); expectedmatch = null; @@ -69,6 +74,7 @@ test(); function addThis() { + statusmessages[i] = status; patterns[i] = pattern; strings[i] = string; actualmatches[i] = actualmatch; @@ -82,6 +88,6 @@ function test() enterFunc ('test'); printBugNumber (bug); printStatus (summary); - testRegExp(patterns, strings, actualmatches, expectedmatches); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); exitFunc ('test'); } diff --git a/js/tests/ecma_3/RegExp/regress-78156.js b/js/tests/ecma_3/RegExp/regress-78156.js index b0039090b94d..08947cecfcee 100644 --- a/js/tests/ecma_3/RegExp/regress-78156.js +++ b/js/tests/ecma_3/RegExp/regress-78156.js @@ -31,6 +31,8 @@ var i = 0; var bug = 78156; var summary = 'Testing regular expressions with ^, $, and the m flag -'; +var status = ''; +var statusmessages = new Array(); var pattern = ''; var patterns = new Array(); var string = ''; @@ -46,22 +48,26 @@ var expectedmatches = new Array(); */ string = 'aaa\n789\r\nccc\r\n345'; + status = inSection(1); pattern = /^\d/gm; actualmatch = string.match(pattern); expectedmatch = ['7','3']; addThis(); + status = inSection(2); pattern = /\d$/gm; actualmatch = string.match(pattern); expectedmatch = ['9','5']; addThis(); string = 'aaa\n789\r\nccc\r\nddd'; + status = inSection(3); pattern = /^\d/gm; actualmatch = string.match(pattern); expectedmatch = ['7']; addThis(); + status = inSection(4); pattern = /\d$/gm; actualmatch = string.match(pattern); expectedmatch = ['9']; @@ -77,6 +83,7 @@ test(); function addThis() { + statusmessages[i] = status; patterns[i] = pattern; strings[i] = string; actualmatches[i] = actualmatch; @@ -90,6 +97,6 @@ function test() enterFunc ('test'); printBugNumber (bug); printStatus (summary); - testRegExp(patterns, strings, actualmatches, expectedmatches); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); exitFunc ('test'); } diff --git a/js/tests/ecma_3/RegExp/regress-87231.js b/js/tests/ecma_3/RegExp/regress-87231.js index 512407e60e9d..03ad8edc80b2 100644 --- a/js/tests/ecma_3/RegExp/regress-87231.js +++ b/js/tests/ecma_3/RegExp/regress-87231.js @@ -41,6 +41,8 @@ var i = 0; var bug = 87231; var cnEmptyString = ''; var summary = 'Testing regular expression /(A)?(A.*)/'; +var status = ''; +var statusmessages = new Array(); var pattern = ''; var patterns = new Array(); var string = ''; @@ -52,16 +54,19 @@ var expectedmatches = new Array(); pattern = /^(A)?(A.*)$/; + status = inSection(1); string = 'AAA'; actualmatch = string.match(pattern); expectedmatch = Array('AAA', 'A', 'AA'); addThis(); + status = inSection(2); string = 'AA'; actualmatch = string.match(pattern); expectedmatch = Array('AA', 'A', 'A'); addThis(); + status = inSection(3); string = 'A'; actualmatch = string.match(pattern); expectedmatch = Array('A', cnEmptyString, 'A'); // 'altruistic' case: see above @@ -72,16 +77,19 @@ pattern = /(A)?(A.*)/; var strL = 'zxcasd;fl\\\ ^'; var strR = 'aaAAaaaf;lrlrzs'; + status = inSection(4); string = strL + 'AAA' + strR; actualmatch = string.match(pattern); expectedmatch = Array('AAA' + strR, 'A', 'AA' + strR); addThis(); + status = inSection(5); string = strL + 'AA' + strR; actualmatch = string.match(pattern); expectedmatch = Array('AA' + strR, 'A', 'A' + strR); addThis(); + status = inSection(6); string = strL + 'A' + strR; actualmatch = string.match(pattern); expectedmatch = Array('A' + strR, cnEmptyString, 'A' + strR); // 'altruistic' case: see above @@ -97,6 +105,7 @@ test(); function addThis() { + statusmessages[i] = status; patterns[i] = pattern; strings[i] = string; actualmatches[i] = actualmatch; @@ -110,6 +119,6 @@ function test() enterFunc ('test'); printBugNumber (bug); printStatus (summary); - testRegExp(patterns, strings, actualmatches, expectedmatches); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); exitFunc ('test'); }