js/src/tests/ecma_3/RegExp/octal-001.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/. */
     6 /*
     7  *
     8  * Date:    18 July 2002
     9  * SUMMARY: Testing octal sequences in regexps
    10  * See http://bugzilla.mozilla.org/show_bug.cgi?id=141078
    11  *
    12  */
    13 //-----------------------------------------------------------------------------
    14 var i = 0;
    15 var BUGNUMBER = 141078;
    16 var summary = 'Testing octal sequences in regexps';
    17 var status = '';
    18 var statusmessages = new Array();
    19 var pattern = '';
    20 var patterns = new Array();
    21 var string = '';
    22 var strings = new Array();
    23 var actualmatch = '';
    24 var actualmatches = new Array();
    25 var expectedmatch = '';
    26 var expectedmatches = new Array();
    29 status = inSection(1);
    30 pattern = /\240/;
    31 string = 'abc';
    32 actualmatch = string.match(pattern);
    33 expectedmatch = null;
    34 addThis();
    36 /*
    37  * In the following sections, we test the octal escape sequence '\052'.
    38  * This is character code 42, representing the asterisk character '*'.
    39  * The Unicode escape for it would be '\u002A', the hex escape '\x2A'.
    40  */
    41 status = inSection(2);
    42 pattern = /ab\052c/;
    43 string = 'ab*c';
    44 actualmatch = string.match(pattern);
    45 expectedmatch = Array('ab*c');
    46 addThis();
    48 status = inSection(3);
    49 pattern = /ab\052*c/;
    50 string = 'abc';
    51 actualmatch = string.match(pattern);
    52 expectedmatch = Array('abc');
    53 addThis();
    55 status = inSection(4);
    56 pattern = /ab(\052)+c/;
    57 string = 'ab****c';
    58 actualmatch = string.match(pattern);
    59 expectedmatch = Array('ab****c', '*');
    60 addThis();
    62 status = inSection(5);
    63 pattern = /ab((\052)+)c/;
    64 string = 'ab****c';
    65 actualmatch = string.match(pattern);
    66 expectedmatch = Array('ab****c', '****', '*');
    67 addThis();
    69 status = inSection(6);
    70 pattern = /(?:\052)c/;
    71 string = 'ab****c';
    72 actualmatch = string.match(pattern);
    73 expectedmatch = Array('*c');
    74 addThis();
    78 //-----------------------------------------------------------------------------
    79 test();
    80 //-----------------------------------------------------------------------------
    84 function addThis()
    85 {
    86   statusmessages[i] = status;
    87   patterns[i] = pattern;
    88   strings[i] = string;
    89   actualmatches[i] = actualmatch;
    90   expectedmatches[i] = expectedmatch;
    91   i++;
    92 }
    95 function test()
    96 {
    97   enterFunc('test');
    98   printBugNumber(BUGNUMBER);
    99   printStatus(summary);
   100   testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
   101   exitFunc ('test');
   102 }

mercurial