js/src/tests/js1_5/extensions/regress-351463-01.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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 var BUGNUMBER = 351463;
michael@0 8 var summary = 'Treat hyphens as not special adjacent to CharacterClassEscapes in character classes';
michael@0 9 var actual = '';
michael@0 10 var expect = '';
michael@0 11
michael@0 12
michael@0 13 //-----------------------------------------------------------------------------
michael@0 14 test();
michael@0 15 //-----------------------------------------------------------------------------
michael@0 16
michael@0 17 function test()
michael@0 18 {
michael@0 19 enterFunc ('test');
michael@0 20 printBugNumber(BUGNUMBER);
michael@0 21 printStatus (summary);
michael@0 22
michael@0 23 var r;
michael@0 24 var s = 'a0- z';
michael@0 25
michael@0 26 r = '([\\d-\\s]+)';
michael@0 27 expect = ['0- ', '0- '] + '';
michael@0 28 actual = null;
michael@0 29
michael@0 30 try
michael@0 31 {
michael@0 32 actual = new RegExp(r).exec(s) + '';
michael@0 33 }
michael@0 34 catch(ex)
michael@0 35 {
michael@0 36 actual = ex + '';
michael@0 37 }
michael@0 38 reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")');
michael@0 39
michael@0 40 r = '([\\s-\\d]+)';
michael@0 41 expect = ['0- ', '0- '] + '';
michael@0 42 actual = null;
michael@0 43
michael@0 44 try
michael@0 45 {
michael@0 46 actual = new RegExp(r).exec(s) + '';
michael@0 47 }
michael@0 48 catch(ex)
michael@0 49 {
michael@0 50 actual = ex + '';
michael@0 51 }
michael@0 52 reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")');
michael@0 53
michael@0 54 r = '([\\D-\\s]+)';
michael@0 55 expect = ['a', 'a'] + '';
michael@0 56 actual = null;
michael@0 57
michael@0 58 try
michael@0 59 {
michael@0 60 actual = new RegExp(r).exec(s) + '';
michael@0 61 }
michael@0 62 catch(ex)
michael@0 63 {
michael@0 64 actual = ex + '';
michael@0 65 }
michael@0 66 reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")');
michael@0 67
michael@0 68 r = '([\\s-\\D]+)';
michael@0 69 expect = ['a', 'a'] + '';
michael@0 70 actual = null;
michael@0 71
michael@0 72 try
michael@0 73 {
michael@0 74 actual = new RegExp(r).exec(s) + '';
michael@0 75 }
michael@0 76 catch(ex)
michael@0 77 {
michael@0 78 actual = ex + '';
michael@0 79 }
michael@0 80 reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")');
michael@0 81
michael@0 82 r = '([\\d-\\S]+)';
michael@0 83 expect = ['a0-', 'a0-'] + '';
michael@0 84 actual = null;
michael@0 85
michael@0 86 try
michael@0 87 {
michael@0 88 actual = new RegExp(r).exec(s) + '';
michael@0 89 }
michael@0 90 catch(ex)
michael@0 91 {
michael@0 92 actual = ex + '';
michael@0 93 }
michael@0 94 reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")');
michael@0 95
michael@0 96 r = '([\\S-\\d]+)';
michael@0 97 expect = ['a0-', 'a0-'] + '';
michael@0 98 actual = null;
michael@0 99
michael@0 100 try
michael@0 101 {
michael@0 102 actual = new RegExp(r).exec(s) + '';
michael@0 103 }
michael@0 104 catch(ex)
michael@0 105 {
michael@0 106 actual = ex + '';
michael@0 107 }
michael@0 108 reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")');
michael@0 109
michael@0 110 r = '([\\D-\\S]+)';
michael@0 111 expect = ['a0- z', 'a0- z'] + '';
michael@0 112 actual = null;
michael@0 113
michael@0 114 try
michael@0 115 {
michael@0 116 actual = new RegExp(r).exec(s) + '';
michael@0 117 }
michael@0 118 catch(ex)
michael@0 119 {
michael@0 120 actual = ex + '';
michael@0 121 }
michael@0 122 reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")');
michael@0 123
michael@0 124 r = '([\\S-\\D]+)';
michael@0 125 expect = ['a0- z', 'a0- z'] + '';
michael@0 126 actual = null;
michael@0 127
michael@0 128 try
michael@0 129 {
michael@0 130 actual = new RegExp(r).exec(s) + '';
michael@0 131 }
michael@0 132 catch(ex)
michael@0 133 {
michael@0 134 actual = ex + '';
michael@0 135 }
michael@0 136 reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")');
michael@0 137
michael@0 138 // --
michael@0 139
michael@0 140 r = '([\\w-\\s]+)';
michael@0 141 expect = ['a0- z', 'a0- z'] + '';
michael@0 142 actual = null;
michael@0 143
michael@0 144 try
michael@0 145 {
michael@0 146 actual = new RegExp(r).exec(s) + '';
michael@0 147 }
michael@0 148 catch(ex)
michael@0 149 {
michael@0 150 actual = ex + '';
michael@0 151 }
michael@0 152 reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")');
michael@0 153
michael@0 154 r = '([\\s-\\w]+)';
michael@0 155 expect = ['a0- z', 'a0- z'] + '';
michael@0 156 actual = null;
michael@0 157
michael@0 158 try
michael@0 159 {
michael@0 160 actual = new RegExp(r).exec(s) + '';
michael@0 161 }
michael@0 162 catch(ex)
michael@0 163 {
michael@0 164 actual = ex + '';
michael@0 165 }
michael@0 166 reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")');
michael@0 167
michael@0 168 r = '([\\W-\\s]+)';
michael@0 169 expect = ['- ', '- '] + '';
michael@0 170 actual = null;
michael@0 171
michael@0 172 try
michael@0 173 {
michael@0 174 actual = new RegExp(r).exec(s) + '';
michael@0 175 }
michael@0 176 catch(ex)
michael@0 177 {
michael@0 178 actual = ex + '';
michael@0 179 }
michael@0 180 reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")');
michael@0 181
michael@0 182 r = '([\\s-\\W]+)';
michael@0 183 expect = ['- ', '- '] + '';
michael@0 184 actual = null;
michael@0 185
michael@0 186 try
michael@0 187 {
michael@0 188 actual = new RegExp(r).exec(s) + '';
michael@0 189 }
michael@0 190 catch(ex)
michael@0 191 {
michael@0 192 actual = ex + '';
michael@0 193 }
michael@0 194 reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")');
michael@0 195
michael@0 196 r = '([\\w-\\S]+)';
michael@0 197 expect = ['a0-', 'a0-'] + '';
michael@0 198 actual = null;
michael@0 199
michael@0 200 try
michael@0 201 {
michael@0 202 actual = new RegExp(r).exec(s) + '';
michael@0 203 }
michael@0 204 catch(ex)
michael@0 205 {
michael@0 206 actual = ex + '';
michael@0 207 }
michael@0 208 reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")');
michael@0 209
michael@0 210 r = '([\\S-\\w]+)';
michael@0 211 expect = ['a0-', 'a0-'] + '';
michael@0 212 actual = null;
michael@0 213
michael@0 214 try
michael@0 215 {
michael@0 216 actual = new RegExp(r).exec(s) + '';
michael@0 217 }
michael@0 218 catch(ex)
michael@0 219 {
michael@0 220 actual = ex + '';
michael@0 221 }
michael@0 222 reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")');
michael@0 223
michael@0 224 r = '([\\W-\\S]+)';
michael@0 225 expect = ['a0- z', 'a0- z'] + '';
michael@0 226 actual = null;
michael@0 227
michael@0 228 try
michael@0 229 {
michael@0 230 actual = new RegExp(r).exec(s) + '';
michael@0 231 }
michael@0 232 catch(ex)
michael@0 233 {
michael@0 234 actual = ex + '';
michael@0 235 }
michael@0 236 reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")');
michael@0 237
michael@0 238 r = '([\\S-\\W]+)';
michael@0 239 expect = ['a0- z', 'a0- z'] + '';
michael@0 240 actual = null;
michael@0 241
michael@0 242 try
michael@0 243 {
michael@0 244 actual = new RegExp(r).exec(s) + '';
michael@0 245 }
michael@0 246 catch(ex)
michael@0 247 {
michael@0 248 actual = ex + '';
michael@0 249 }
michael@0 250 reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")');
michael@0 251
michael@0 252
michael@0 253 exitFunc ('test');
michael@0 254 }

mercurial