js/src/tests/js1_2/regexp/vertical_bar.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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/. */
     7 /**
     8    Filename:     vertical_bar.js
     9    Description:  'Tests regular expressions containing |'
    11    Author:       Nick Lerissa
    12    Date:         March 10, 1998
    13 */
    15 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
    16 var VERSION = 'no version';
    17 startTest();
    18 var TITLE   = 'RegExp: |';
    20 writeHeaderToLog('Executing script: vertical_bar.js');
    21 writeHeaderToLog( SECTION + " "+ TITLE);
    24 // 'abc'.match(new RegExp('xyz|abc'))
    25 new TestCase ( SECTION, "'abc'.match(new RegExp('xyz|abc'))",
    26 	       String(["abc"]), String('abc'.match(new RegExp('xyz|abc'))));
    28 // 'this is a test'.match(new RegExp('quiz|exam|test|homework'))
    29 new TestCase ( SECTION, "'this is a test'.match(new RegExp('quiz|exam|test|homework'))",
    30 	       String(["test"]), String('this is a test'.match(new RegExp('quiz|exam|test|homework'))));
    32 // 'abc'.match(new RegExp('xyz|...'))
    33 new TestCase ( SECTION, "'abc'.match(new RegExp('xyz|...'))",
    34 	       String(["abc"]), String('abc'.match(new RegExp('xyz|...'))));
    36 // 'abc'.match(new RegExp('(.)..|abc'))
    37 new TestCase ( SECTION, "'abc'.match(new RegExp('(.)..|abc'))",
    38 	       String(["abc","a"]), String('abc'.match(new RegExp('(.)..|abc'))));
    40 // 'color: grey'.match(new RegExp('.+: gr(a|e)y'))
    41 new TestCase ( SECTION, "'color: grey'.match(new RegExp('.+: gr(a|e)y'))",
    42 	       String(["color: grey","e"]), String('color: grey'.match(new RegExp('.+: gr(a|e)y'))));
    44 // 'no match'.match(new RegExp('red|white|blue'))
    45 new TestCase ( SECTION, "'no match'.match(new RegExp('red|white|blue'))",
    46 	       null, 'no match'.match(new RegExp('red|white|blue')));
    48 // 'Hi Bob'.match(new RegExp('(Rob)|(Bob)|(Robert)|(Bobby)'))
    49 new TestCase ( SECTION, "'Hi Bob'.match(new RegExp('(Rob)|(Bob)|(Robert)|(Bobby)'))",
    50 	       String(["Bob",undefined,"Bob", undefined, undefined]), String('Hi Bob'.match(new RegExp('(Rob)|(Bob)|(Robert)|(Bobby)'))));
    52 // 'abcdef'.match(new RegExp('abc|bcd|cde|def'))
    53 new TestCase ( SECTION, "'abcdef'.match(new RegExp('abc|bcd|cde|def'))",
    54 	       String(["abc"]), String('abcdef'.match(new RegExp('abc|bcd|cde|def'))));
    56 // 'Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/)
    57 new TestCase ( SECTION, "'Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/)",
    58 	       String(["Bob",undefined,"Bob", undefined, undefined]), String('Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/)));
    60 // 'abcdef'.match(/abc|bcd|cde|def/)
    61 new TestCase ( SECTION, "'abcdef'.match(/abc|bcd|cde|def/)",
    62 	       String(["abc"]), String('abcdef'.match(/abc|bcd|cde|def/)));
    64 test();

mercurial