| 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 |
* |
| 8 |
* Date: 31 August 2002 |
| 9 |
* SUMMARY: RegExp conformance test |
| 10 |
* See http://bugzilla.mozilla.org/show_bug.cgi?id=169497 |
| 11 |
* |
| 12 |
*/ |
| 13 |
//----------------------------------------------------------------------------- |
| 14 |
var i = 0; |
| 15 |
var BUGNUMBER = 169497; |
| 16 |
var summary = 'RegExp conformance test'; |
| 17 |
var status = ''; |
| 18 |
var statusmessages = new Array(); |
| 19 |
var pattern = ''; |
| 20 |
var patterns = new Array(); |
| 21 |
var sBody = ''; |
| 22 |
var sHTML = ''; |
| 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 |
sBody += '<body onXXX="alert(event.type);">\n'; |
| 31 |
sBody += '<p>Kibology for all<\/p>\n'; |
| 32 |
sBody += '<p>All for Kibology<\/p>\n'; |
| 33 |
sBody += '<\/body>'; |
| 34 |
|
| 35 |
sHTML += '<html>\n'; |
| 36 |
sHTML += sBody; |
| 37 |
sHTML += '\n<\/html>'; |
| 38 |
|
| 39 |
status = inSection(1); |
| 40 |
string = sHTML; |
| 41 |
pattern = /<body.*>((.*\n?)*?)<\/body>/i; |
| 42 |
actualmatch = string.match(pattern); |
| 43 |
expectedmatch = Array(sBody, '\n<p>Kibology for all</p>\n<p>All for Kibology</p>\n', '<p>All for Kibology</p>\n'); |
| 44 |
addThis(); |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
//------------------------------------------------------------------------------------------------- |
| 49 |
test(); |
| 50 |
//------------------------------------------------------------------------------------------------- |
| 51 |
|
| 52 |
|
| 53 |
function addThis() |
| 54 |
{ |
| 55 |
statusmessages[i] = status; |
| 56 |
patterns[i] = pattern; |
| 57 |
strings[i] = string; |
| 58 |
actualmatches[i] = actualmatch; |
| 59 |
expectedmatches[i] = expectedmatch; |
| 60 |
i++; |
| 61 |
} |
| 62 |
|
| 63 |
|
| 64 |
function test() |
| 65 |
{ |
| 66 |
printBugNumber(BUGNUMBER); |
| 67 |
printStatus (summary); |
| 68 |
testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); |
| 69 |
} |