js/src/tests/js1_2/regexp/RegExp_object.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:     RegExp_object.js
     9    Description:  'Tests regular expressions creating RexExp Objects'
    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: object';
    20 writeHeaderToLog('Executing script: RegExp_object.js');
    21 writeHeaderToLog( SECTION + " "+ TITLE);
    23 var SSN_pattern = new RegExp("\\d{3}-\\d{2}-\\d{4}");
    25 // testing SSN pattern
    26 new TestCase ( SECTION, "'Test SSN is 123-34-4567'.match(SSN_pattern))",
    27 	       String(["123-34-4567"]), String('Test SSN is 123-34-4567'.match(SSN_pattern)));
    29 // testing SSN pattern
    30 new TestCase ( SECTION, "'Test SSN is 123-34-4567'.match(SSN_pattern))",
    31 	       String(["123-34-4567"]), String('Test SSN is 123-34-4567'.match(SSN_pattern)));
    33 var PHONE_pattern = new RegExp("\\(?(\\d{3})\\)?-?(\\d{3})-(\\d{4})");
    34 // testing PHONE pattern
    35 new TestCase ( SECTION, "'Our phone number is (408)345-2345.'.match(PHONE_pattern))",
    36 	       String(["(408)345-2345","408","345","2345"]), String('Our phone number is (408)345-2345.'.match(PHONE_pattern)));
    38 // testing PHONE pattern
    39 new TestCase ( SECTION, "'The phone number is 408-345-2345!'.match(PHONE_pattern))",
    40 	       String(["408-345-2345","408","345","2345"]), String('The phone number is 408-345-2345!'.match(PHONE_pattern)));
    42 // testing PHONE pattern
    43 new TestCase ( SECTION, "String(PHONE_pattern.toString())",
    44 	       "/\\(?(\\d{3})\\)?-?(\\d{3})-(\\d{4})/", String(PHONE_pattern.toString()));
    46 // testing conversion to String
    47 new TestCase ( SECTION, "PHONE_pattern + ' is the string'",
    48 	       "/\\(?(\\d{3})\\)?-?(\\d{3})-(\\d{4})/ is the string",PHONE_pattern + ' is the string');
    50 // testing conversion to int
    51 new TestCase ( SECTION, "SSN_pattern - 8",
    52 	       NaN,SSN_pattern - 8);
    54 var testPattern = new RegExp("(\\d+)45(\\d+)90");
    56 test();

mercurial