tor-browser

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

RegExp_leftContext_as_array.js (1817B)


      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_as_array.js
      9   Description:  'Tests RegExps leftContext property (same tests as RegExp_leftContext.js but using $`)'
     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: $`';
     17 
     18 writeHeaderToLog('Executing script: RegExp_leftContext_as_array.js');
     19 writeHeaderToLog( SECTION + " "+ TITLE);
     20 
     21 // 'abc123xyz'.match(/123/); RegExp['$`']
     22 'abc123xyz'.match(/123/);
     23 new TestCase ( "'abc123xyz'.match(/123/); RegExp['$`']",
     24        'abc', RegExp['$`']);
     25 
     26 // 'abc123xyz'.match(/456/); RegExp['$`']
     27 'abc123xyz'.match(/456/);
     28 new TestCase ( "'abc123xyz'.match(/456/); RegExp['$`']",
     29        'abc', RegExp['$`']);
     30 
     31 // 'abc123xyz'.match(/abc123xyz/); RegExp['$`']
     32 'abc123xyz'.match(/abc123xyz/);
     33 new TestCase ( "'abc123xyz'.match(/abc123xyz/); RegExp['$`']",
     34        '', RegExp['$`']);
     35 
     36 // 'xxxx'.match(/$/); RegExp['$`']
     37 'xxxx'.match(/$/);
     38 new TestCase ( "'xxxx'.match(/$/); RegExp['$`']",
     39        'xxxx', RegExp['$`']);
     40 
     41 // 'test'.match(/^/); RegExp['$`']
     42 'test'.match(/^/);
     43 new TestCase ( "'test'.match(/^/); RegExp['$`']",
     44        '', RegExp['$`']);
     45 
     46 // 'xxxx'.match(new RegExp('$')); RegExp['$`']
     47 'xxxx'.match(new RegExp('$'));
     48 new TestCase ( "'xxxx'.match(new RegExp('$')); RegExp['$`']",
     49        'xxxx', RegExp['$`']);
     50 
     51 // 'test'.match(new RegExp('^')); RegExp['$`']
     52 'test'.match(new RegExp('^'));
     53 new TestCase ( "'test'.match(new RegExp('^')); RegExp['$`']",
     54        '', RegExp['$`']);
     55 
     56 test();