js/src/tests/ecma_3/RegExp/regress-100199.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.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 /*
michael@0 7 * Date: 17 September 2001
michael@0 8 *
michael@0 9 * SUMMARY: Regression test for Bugzilla bug 100199
michael@0 10 * See http://bugzilla.mozilla.org/show_bug.cgi?id=100199
michael@0 11 *
michael@0 12 * The empty character class [] is a valid RegExp construct: the condition
michael@0 13 * that a given character belong to a set containing no characters. As such,
michael@0 14 * it can never be met and is always FALSE. Similarly, [^] is a condition
michael@0 15 * that matches any given character and is always TRUE.
michael@0 16 *
michael@0 17 * Neither one of these conditions should cause syntax errors in a RegExp.
michael@0 18 */
michael@0 19 //-----------------------------------------------------------------------------
michael@0 20 var i = 0;
michael@0 21 var BUGNUMBER = 100199;
michael@0 22 var summary = '[], [^] are valid RegExp conditions. Should not cause errors -';
michael@0 23 var status = '';
michael@0 24 var statusmessages = new Array();
michael@0 25 var pattern = '';
michael@0 26 var patterns = new Array();
michael@0 27 var string = '';
michael@0 28 var strings = new Array();
michael@0 29 var actualmatch = '';
michael@0 30 var actualmatches = new Array();
michael@0 31 var expectedmatch = '';
michael@0 32 var expectedmatches = new Array();
michael@0 33
michael@0 34
michael@0 35 pattern = /[]/;
michael@0 36 string = 'abc';
michael@0 37 status = inSection(1);
michael@0 38 actualmatch = string.match(pattern);
michael@0 39 expectedmatch = null;
michael@0 40 addThis();
michael@0 41
michael@0 42 string = '';
michael@0 43 status = inSection(2);
michael@0 44 actualmatch = string.match(pattern);
michael@0 45 expectedmatch = null;
michael@0 46 addThis();
michael@0 47
michael@0 48 string = '[';
michael@0 49 status = inSection(3);
michael@0 50 actualmatch = string.match(pattern);
michael@0 51 expectedmatch = null;
michael@0 52 addThis();
michael@0 53
michael@0 54 string = '/';
michael@0 55 status = inSection(4);
michael@0 56 actualmatch = string.match(pattern);
michael@0 57 expectedmatch = null;
michael@0 58 addThis();
michael@0 59
michael@0 60 string = '[';
michael@0 61 status = inSection(5);
michael@0 62 actualmatch = string.match(pattern);
michael@0 63 expectedmatch = null;
michael@0 64 addThis();
michael@0 65
michael@0 66 string = ']';
michael@0 67 status = inSection(6);
michael@0 68 actualmatch = string.match(pattern);
michael@0 69 expectedmatch = null;
michael@0 70 addThis();
michael@0 71
michael@0 72 string = '[]';
michael@0 73 status = inSection(7);
michael@0 74 actualmatch = string.match(pattern);
michael@0 75 expectedmatch = null;
michael@0 76 addThis();
michael@0 77
michael@0 78 string = '[ ]';
michael@0 79 status = inSection(8);
michael@0 80 actualmatch = string.match(pattern);
michael@0 81 expectedmatch = null;
michael@0 82 addThis();
michael@0 83
michael@0 84 string = '][';
michael@0 85 status = inSection(9);
michael@0 86 actualmatch = string.match(pattern);
michael@0 87 expectedmatch = null;
michael@0 88 addThis();
michael@0 89
michael@0 90
michael@0 91 pattern = /a[]/;
michael@0 92 string = 'abc';
michael@0 93 status = inSection(10);
michael@0 94 actualmatch = string.match(pattern);
michael@0 95 expectedmatch = null;
michael@0 96 addThis();
michael@0 97
michael@0 98 string = '';
michael@0 99 status = inSection(11);
michael@0 100 actualmatch = string.match(pattern);
michael@0 101 expectedmatch = null;
michael@0 102 addThis();
michael@0 103
michael@0 104 string = 'a[';
michael@0 105 status = inSection(12);
michael@0 106 actualmatch = string.match(pattern);
michael@0 107 expectedmatch = null;
michael@0 108 addThis();
michael@0 109
michael@0 110 string = 'a[]';
michael@0 111 status = inSection(13);
michael@0 112 actualmatch = string.match(pattern);
michael@0 113 expectedmatch = null;
michael@0 114 addThis();
michael@0 115
michael@0 116 string = '[';
michael@0 117 status = inSection(14);
michael@0 118 actualmatch = string.match(pattern);
michael@0 119 expectedmatch = null;
michael@0 120 addThis();
michael@0 121
michael@0 122 string = ']';
michael@0 123 status = inSection(15);
michael@0 124 actualmatch = string.match(pattern);
michael@0 125 expectedmatch = null;
michael@0 126 addThis();
michael@0 127
michael@0 128 string = '[]';
michael@0 129 status = inSection(16);
michael@0 130 actualmatch = string.match(pattern);
michael@0 131 expectedmatch = null;
michael@0 132 addThis();
michael@0 133
michael@0 134 string = '[ ]';
michael@0 135 status = inSection(17);
michael@0 136 actualmatch = string.match(pattern);
michael@0 137 expectedmatch = null;
michael@0 138 addThis();
michael@0 139
michael@0 140 string = '][';
michael@0 141 status = inSection(18);
michael@0 142 actualmatch = string.match(pattern);
michael@0 143 expectedmatch = null;
michael@0 144 addThis();
michael@0 145
michael@0 146
michael@0 147 pattern = /[^]/;
michael@0 148 string = 'abc';
michael@0 149 status = inSection(19);
michael@0 150 actualmatch = string.match(pattern);
michael@0 151 expectedmatch = Array('a');
michael@0 152 addThis();
michael@0 153
michael@0 154 string = '';
michael@0 155 status = inSection(20);
michael@0 156 actualmatch = string.match(pattern);
michael@0 157 expectedmatch = null; //there are no characters to test against the condition
michael@0 158 addThis();
michael@0 159
michael@0 160 string = '\/';
michael@0 161 status = inSection(21);
michael@0 162 actualmatch = string.match(pattern);
michael@0 163 expectedmatch = Array('/');
michael@0 164 addThis();
michael@0 165
michael@0 166 string = '\[';
michael@0 167 status = inSection(22);
michael@0 168 actualmatch = string.match(pattern);
michael@0 169 expectedmatch = Array('[');
michael@0 170 addThis();
michael@0 171
michael@0 172 string = '[';
michael@0 173 status = inSection(23);
michael@0 174 actualmatch = string.match(pattern);
michael@0 175 expectedmatch = Array('[');
michael@0 176 addThis();
michael@0 177
michael@0 178 string = ']';
michael@0 179 status = inSection(24);
michael@0 180 actualmatch = string.match(pattern);
michael@0 181 expectedmatch = Array(']');
michael@0 182 addThis();
michael@0 183
michael@0 184 string = '[]';
michael@0 185 status = inSection(25);
michael@0 186 actualmatch = string.match(pattern);
michael@0 187 expectedmatch = Array('[');
michael@0 188 addThis();
michael@0 189
michael@0 190 string = '[ ]';
michael@0 191 status = inSection(26);
michael@0 192 actualmatch = string.match(pattern);
michael@0 193 expectedmatch = Array('[');
michael@0 194 addThis();
michael@0 195
michael@0 196 string = '][';
michael@0 197 status = inSection(27);
michael@0 198 actualmatch = string.match(pattern);
michael@0 199 expectedmatch = Array(']');
michael@0 200 addThis();
michael@0 201
michael@0 202
michael@0 203 pattern = /a[^]/;
michael@0 204 string = 'abc';
michael@0 205 status = inSection(28);
michael@0 206 actualmatch = string.match(pattern);
michael@0 207 expectedmatch = Array('ab');
michael@0 208 addThis();
michael@0 209
michael@0 210 string = '';
michael@0 211 status = inSection(29);
michael@0 212 actualmatch = string.match(pattern);
michael@0 213 expectedmatch = null; //there are no characters to test against the condition
michael@0 214 addThis();
michael@0 215
michael@0 216 string = 'a[';
michael@0 217 status = inSection(30);
michael@0 218 actualmatch = string.match(pattern);
michael@0 219 expectedmatch = Array('a[');
michael@0 220 addThis();
michael@0 221
michael@0 222 string = 'a]';
michael@0 223 status = inSection(31);
michael@0 224 actualmatch = string.match(pattern);
michael@0 225 expectedmatch = Array('a]');
michael@0 226 addThis();
michael@0 227
michael@0 228 string = 'a[]';
michael@0 229 status = inSection(32);
michael@0 230 actualmatch = string.match(pattern);
michael@0 231 expectedmatch = Array('a[');
michael@0 232 addThis();
michael@0 233
michael@0 234 string = 'a[ ]';
michael@0 235 status = inSection(33);
michael@0 236 actualmatch = string.match(pattern);
michael@0 237 expectedmatch = Array('a[');
michael@0 238 addThis();
michael@0 239
michael@0 240 string = 'a][';
michael@0 241 status = inSection(34);
michael@0 242 actualmatch = string.match(pattern);
michael@0 243 expectedmatch = Array('a]');
michael@0 244 addThis();
michael@0 245
michael@0 246
michael@0 247
michael@0 248
michael@0 249 //-----------------------------------------------------------------------------
michael@0 250 test();
michael@0 251 //-----------------------------------------------------------------------------
michael@0 252
michael@0 253
michael@0 254
michael@0 255 function addThis()
michael@0 256 {
michael@0 257 statusmessages[i] = status;
michael@0 258 patterns[i] = pattern;
michael@0 259 strings[i] = string;
michael@0 260 actualmatches[i] = actualmatch;
michael@0 261 expectedmatches[i] = expectedmatch;
michael@0 262 i++;
michael@0 263 }
michael@0 264
michael@0 265
michael@0 266 function test()
michael@0 267 {
michael@0 268 enterFunc ('test');
michael@0 269 printBugNumber(BUGNUMBER);
michael@0 270 printStatus (summary);
michael@0 271 testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
michael@0 272 exitFunc ('test');
michael@0 273 }

mercurial