regress-169534.js (1484B)
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: 20 Sep 2002 9 * SUMMARY: RegExp conformance test 10 * See http://bugzilla.mozilla.org/show_bug.cgi?id=169534 11 * 12 */ 13 //----------------------------------------------------------------------------- 14 var UBound = 0; 15 var BUGNUMBER = 169534; 16 var summary = 'RegExp conformance test'; 17 var status = ''; 18 var statusitems = []; 19 var actual = ''; 20 var actualvalues = []; 21 var expect= ''; 22 var expectedvalues = []; 23 24 25 status = inSection(1); 26 var re = /(\|)([\w\x81-\xff ]*)(\|)([\/a-z][\w:\/\.]*\.[a-z]{3,4})(\|)/ig; 27 var str = "To sign up click |here|https://www.xxxx.org/subscribe.htm|"; 28 actual = str.replace(re, '<a href="$4">$2</a>'); 29 expect = 'To sign up click <a href="https://www.xxxx.org/subscribe.htm">here</a>'; 30 addThis(); 31 32 33 34 //----------------------------------------------------------------------------- 35 test(); 36 //----------------------------------------------------------------------------- 37 38 39 40 function addThis() 41 { 42 statusitems[UBound] = status; 43 actualvalues[UBound] = actual; 44 expectedvalues[UBound] = expect; 45 UBound++; 46 } 47 48 49 function test() 50 { 51 printBugNumber(BUGNUMBER); 52 printStatus(summary); 53 54 for (var i=0; i<UBound; i++) 55 { 56 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); 57 } 58 }