tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

regress-202564.js (1908B)


      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:    18 April 2003
      9 * SUMMARY: Testing regexp with many backreferences
     10 * See http://bugzilla.mozilla.org/show_bug.cgi?id=202564
     11 *
     12 * Note that in Section 1 below, we expect the 1st and 4th backreferences
     13 * to hold |undefined| instead of the empty strings one gets in Perl and IE6.
     14 * This is because per ECMA, regexp backreferences must hold |undefined|
     15 * if not used. See http://bugzilla.mozilla.org/show_bug.cgi?id=123437.
     16 *
     17 */
     18 //-----------------------------------------------------------------------------
     19 var i = 0;
     20 var BUGNUMBER = 202564;
     21 var summary = 'Testing regexp with many backreferences';
     22 var status = '';
     23 var statusmessages = new Array();
     24 var pattern = '';
     25 var patterns = new Array();
     26 var string = '';
     27 var strings = new Array();
     28 var actualmatch = '';
     29 var actualmatches = new Array();
     30 var expectedmatch = '';
     31 var expectedmatches = new Array();
     32 
     33 
     34 status = inSection(1);
     35 string = 'Seattle, WA to Buckley, WA';
     36 pattern = /(?:(.+), )?(.+), (..) to (?:(.+), )?(.+), (..)/;
     37 actualmatch = string.match(pattern);
     38 expectedmatch = Array(string, undefined, "Seattle", "WA", undefined, "Buckley", "WA");
     39 addThis();
     40 
     41 
     42 
     43 //-----------------------------------------------------------------------------
     44 test();
     45 //-----------------------------------------------------------------------------
     46 
     47 
     48 
     49 function addThis()
     50 {
     51  statusmessages[i] = status;
     52  patterns[i] = pattern;
     53  strings[i] = string;
     54  actualmatches[i] = actualmatch;
     55  expectedmatches[i] = expectedmatch;
     56  i++;
     57 }
     58 
     59 
     60 function test()
     61 {
     62  printBugNumber(BUGNUMBER);
     63  printStatus (summary);
     64  testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
     65 }