tor-browser

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

regress-001.js (1178B)


      1 /* -*- tab-width: 2; 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 *  File Name:          RegExp/regress-001.js
      9 *  ECMA Section:       N/A
     10 *  Description:        Regression test case:
     11 *  JS regexp anchoring on empty match bug
     12 *  http://bugzilla.mozilla.org/show_bug.cgi?id=2157
     13 *
     14 *  Author:             christine@netscape.com
     15 *  Date:               19 February 1999
     16 */
     17 var SECTION = "RegExp/hex-001.js";
     18 var TITLE   = "JS regexp anchoring on empty match bug";
     19 var BUGNUMBER = "2157";
     20 
     21 printBugNumber(BUGNUMBER);
     22 
     23 AddRegExpCases( /a||b/.exec(''),
     24 	"/a||b/.exec('')",
     25 	1,
     26 	[''] );
     27 
     28 test();
     29 
     30 function AddRegExpCases( regexp, str_regexp, length, matches_array ) {
     31 
     32  AddTestCase(
     33    "( " + str_regexp + " ).length",
     34    regexp.length,
     35    regexp.length );
     36 
     37 
     38  for ( var matches = 0; matches < matches_array.length; matches++ ) {
     39    AddTestCase(
     40      "( " + str_regexp + " )[" + matches +"]",
     41      matches_array[matches],
     42      regexp[matches] );
     43  }
     44 }