regress-220367-001.js (1633B)
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: 26 September 2003 9 * SUMMARY: Regexp conformance test 10 * 11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=220367 12 * 13 */ 14 //----------------------------------------------------------------------------- 15 var i = 0; 16 var BUGNUMBER = 220367; 17 var summary = 'Regexp conformance test'; 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 status = inSection(1); 31 string = 'a'; 32 pattern = /(a)|(b)/; 33 actualmatch = string.match(pattern); 34 expectedmatch = Array(string, 'a', undefined); 35 addThis(); 36 37 status = inSection(2); 38 string = 'b'; 39 pattern = /(a)|(b)/; 40 actualmatch = string.match(pattern); 41 expectedmatch = Array(string, undefined, 'b'); 42 addThis(); 43 44 45 46 //----------------------------------------------------------------------------- 47 test(); 48 //----------------------------------------------------------------------------- 49 50 51 52 function addThis() 53 { 54 statusmessages[i] = status; 55 patterns[i] = pattern; 56 strings[i] = string; 57 actualmatches[i] = actualmatch; 58 expectedmatches[i] = expectedmatch; 59 i++; 60 } 61 62 63 function test() 64 { 65 printBugNumber(BUGNUMBER); 66 printStatus (summary); 67 testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); 68 }