tor-browser

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

RegExp_dollar_number.js (2882B)


      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_dollar_number.js
      9   Description:  'Tests RegExps $1, ..., $9 properties'
     10 
     11   Author:       Nick Lerissa
     12   Date:         March 12, 1998
     13 */
     14 
     15 var SECTION = 'As described in Netscape doc "What\'s new in JavaScript 1.2"';
     16 var TITLE   = 'RegExp: $1, ..., $9';
     17 var BUGNUMBER="123802";
     18 
     19 printBugNumber(BUGNUMBER);
     20 writeHeaderToLog('Executing script: RegExp_dollar_number.js');
     21 writeHeaderToLog( SECTION + " "+ TITLE);
     22 
     23 
     24 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$1
     25 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/);
     26 new TestCase ( "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$1",
     27        'abcdefghi', RegExp.$1);
     28 
     29 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$2
     30 new TestCase ( "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$2",
     31        'bcdefgh', RegExp.$2);
     32 
     33 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$3
     34 new TestCase ( "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$3",
     35        'cdefg', RegExp.$3);
     36 
     37 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$4
     38 new TestCase ( "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$4",
     39        'def', RegExp.$4);
     40 
     41 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$5
     42 new TestCase ( "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$5",
     43        'e', RegExp.$5);
     44 
     45 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$6
     46 new TestCase ( "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$6",
     47        '', RegExp.$6);
     48 
     49 var a_to_z = 'abcdefghijklmnopqrstuvwxyz';
     50 var regexp1 = /(a)b(c)d(e)f(g)h(i)j(k)l(m)n(o)p(q)r(s)t(u)v(w)x(y)z/
     51  // 'abcdefghijklmnopqrstuvwxyz'.match(/(a)b(c)d(e)f(g)h(i)j(k)l(m)n(o)p(q)r(s)t(u)v(w)x(y)z/); RegExp.$1
     52  a_to_z.match(regexp1);
     53 
     54 new TestCase ( "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$1",
     55        'a', RegExp.$1);
     56 new TestCase ( "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$2",
     57        'c', RegExp.$2);
     58 new TestCase ( "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$3",
     59        'e', RegExp.$3);
     60 new TestCase ( "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$4",
     61        'g', RegExp.$4);
     62 new TestCase ( "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$5",
     63        'i', RegExp.$5);
     64 new TestCase ( "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$6",
     65        'k', RegExp.$6);
     66 new TestCase ( "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$7",
     67        'm', RegExp.$7);
     68 new TestCase ( "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$8",
     69        'o', RegExp.$8);
     70 new TestCase ( "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$9",
     71        'q', RegExp.$9);
     72 /*
     73  new TestCase ( "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$10",
     74  's', RegExp.$10);
     75 */
     76 test();