| 1 |
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ |
| 2 |
/* This Source Code Form is subject to the terms of the Mozilla Public |
| 3 |
* License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 5 |
|
| 6 |
/* |
| 7 |
* Date: 01 May 2001 |
| 8 |
* |
| 9 |
* SUMMARY: Regression test for Bugzilla bug 31316: |
| 10 |
* "Rhino: Regexp matches return garbage" |
| 11 |
* |
| 12 |
* See http://bugzilla.mozilla.org/show_bug.cgi?id=31316 |
| 13 |
*/ |
| 14 |
//----------------------------------------------------------------------------- |
| 15 |
var i = 0; |
| 16 |
var BUGNUMBER = 31316; |
| 17 |
var summary = 'Regression test for Bugzilla bug 31316'; |
| 18 |
var cnEmptyString = ''; |
| 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 |
status = inSection(1); |
| 32 |
pattern = /<([^\/<>][^<>]*[^\/])>|<([^\/<>])>/; |
| 33 |
string = '<p>Some<br />test</p>'; |
| 34 |
actualmatch = string.match(pattern); |
| 35 |
expectedmatch = Array('<p>', undefined, 'p'); |
| 36 |
addThis(); |
| 37 |
|
| 38 |
|
| 39 |
//------------------------------------------------------------------------------------------------- |
| 40 |
test(); |
| 41 |
//------------------------------------------------------------------------------------------------- |
| 42 |
|
| 43 |
|
| 44 |
function addThis() |
| 45 |
{ |
| 46 |
statusmessages[i] = status; |
| 47 |
patterns[i] = pattern; |
| 48 |
strings[i] = string; |
| 49 |
actualmatches[i] = actualmatch; |
| 50 |
expectedmatches[i] = expectedmatch; |
| 51 |
i++; |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
function test() |
| 56 |
{ |
| 57 |
printBugNumber(BUGNUMBER); |
| 58 |
printStatus (summary); |
| 59 |
testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); |
| 60 |
} |