regress-76683.js (2229B)
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 76683 on Rhino: 10 * "RegExp regression (NullPointerException)" 11 * 12 * See http://bugzilla.mozilla.org/show_bug.cgi?id=76683 13 */ 14 //----------------------------------------------------------------------------- 15 var i = 0; 16 var BUGNUMBER = 76683; 17 var summary = 'Regression test for Bugzilla bug 76683'; 18 var status = ''; 19 var statusmessages = new Array(); 20 var pattern = ''; 21 var patterns = new Array(); 22 var string = ''; 23 var strings = new Array(); 24 var actualmatch = ''; 25 var actualmatches = new Array(); 26 var expectedmatch = ''; 27 var expectedmatches = new Array(); 28 29 30 /* 31 * Rhino (2001-04-19) crashed on the 3rd regular expression below. 32 * It didn't matter what the string was. No problem in SpiderMonkey - 33 */ 34 string = 'abc'; 35 status = inSection(1); 36 pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<([\$\w:\.\-]+)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))/; 37 actualmatch = string.match(pattern); 38 expectedmatch = null; 39 addThis(); 40 41 status = inSection(2); 42 pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<(tagPattern)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))/; 43 actualmatch = string.match(pattern); 44 expectedmatch = null; 45 addThis(); 46 47 // This was the one causing a Rhino crash - 48 status = inSection(3); 49 pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<(tagPattern)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))|(<\/tagPattern[^>]*>)/; 50 actualmatch = string.match(pattern); 51 expectedmatch = null; 52 addThis(); 53 54 55 56 //------------------------------------------------------------------------------------------------- 57 test(); 58 //------------------------------------------------------------------------------------------------- 59 60 61 62 function addThis() 63 { 64 statusmessages[i] = status; 65 patterns[i] = pattern; 66 strings[i] = string; 67 actualmatches[i] = actualmatch; 68 expectedmatches[i] = expectedmatch; 69 i++; 70 } 71 72 73 function test() 74 { 75 printBugNumber(BUGNUMBER); 76 printStatus (summary); 77 testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); 78 }