tor-browser

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

RegExp_leftContext.js (1883B)


      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   Filename:     RegExp_leftContext.js
      9   Description:  'Tests RegExps leftContext property'
     10 
     11   Author:       Nick Lerissa
     12   Date:         March 12, 1998
     13 */
     14 
     15 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
     16 var TITLE   = 'RegExp: leftContext';
     17 
     18 writeHeaderToLog('Executing script: RegExp_leftContext.js');
     19 writeHeaderToLog( SECTION + " "+ TITLE);
     20 
     21 // 'abc123xyz'.match(/123/); RegExp.leftContext
     22 'abc123xyz'.match(/123/);
     23 new TestCase ( "'abc123xyz'.match(/123/); RegExp.leftContext",
     24        'abc', RegExp.leftContext);
     25 
     26 // 'abc123xyz'.match(/456/); RegExp.leftContext
     27 'abc123xyz'.match(/456/);
     28 new TestCase ( "'abc123xyz'.match(/456/); RegExp.leftContext",
     29        'abc', RegExp.leftContext);
     30 
     31 // 'abc123xyz'.match(/abc123xyz/); RegExp.leftContext
     32 'abc123xyz'.match(/abc123xyz/);
     33 new TestCase ( "'abc123xyz'.match(/abc123xyz/); RegExp.leftContext",
     34        '', RegExp.leftContext);
     35 
     36 // 'xxxx'.match(/$/); RegExp.leftContext
     37 'xxxx'.match(/$/);
     38 new TestCase ( "'xxxx'.match(/$/); RegExp.leftContext",
     39        'xxxx', RegExp.leftContext);
     40 
     41 // 'test'.match(/^/); RegExp.leftContext
     42 'test'.match(/^/);
     43 new TestCase ( "'test'.match(/^/); RegExp.leftContext",
     44        '', RegExp.leftContext);
     45 
     46 // 'xxxx'.match(new RegExp('$')); RegExp.leftContext
     47 'xxxx'.match(new RegExp('$'));
     48 new TestCase ( "'xxxx'.match(new RegExp('$')); RegExp.leftContext",
     49        'xxxx', RegExp.leftContext);
     50 
     51 // 'test'.match(new RegExp('^')); RegExp.leftContext
     52 'test'.match(new RegExp('^'));
     53 new TestCase ( "'test'.match(new RegExp('^')); RegExp.leftContext",
     54        '', RegExp.leftContext);
     55 
     56 test();