| 1 |
/* -*- indent-tabs-mode: nil; js-indent-level: 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/. */ |
| 5 |
|
| 6 |
//----------------------------------------------------------------------------- |
| 7 |
var BUGNUMBER = 465862; |
| 8 |
var summary = 'Do case-insensitive matching correctly in JIT for non-ASCII-letters'; |
| 9 |
|
| 10 |
var i = 0; |
| 11 |
var status = ''; |
| 12 |
var statusmessages = new Array(); |
| 13 |
var pattern = ''; |
| 14 |
var patterns = new Array(); |
| 15 |
var string = ''; |
| 16 |
var strings = new Array(); |
| 17 |
var actualmatch = ''; |
| 18 |
var actualmatches = new Array(); |
| 19 |
var expectedmatch = ''; |
| 20 |
var expectedmatches = new Array(); |
| 21 |
|
| 22 |
// Note: we must call the RegExp constructor here instead of using |
| 23 |
// literals. Otherwise, because the regexps are compiled at parse |
| 24 |
// time, they will not be compiled to native code and we will not |
| 25 |
// actually be testing jitted regexps. |
| 26 |
|
| 27 |
|
| 28 |
status = inSection(1); |
| 29 |
string = '@'; |
| 30 |
pattern = new RegExp('@', 'i'); |
| 31 |
actualmatch = string.match(pattern); |
| 32 |
expectedmatch = Array(string); |
| 33 |
addThis(); |
| 34 |
|
| 35 |
status = inSection(2); |
| 36 |
string = '`'; |
| 37 |
pattern = new RegExp('`', 'i'); |
| 38 |
actualmatch = string.match(pattern); |
| 39 |
expectedmatch = Array(string); |
| 40 |
addThis(); |
| 41 |
|
| 42 |
status = inSection(3); |
| 43 |
string = '@'; |
| 44 |
pattern = new RegExp('`', 'i'); |
| 45 |
actualmatch = string.match(pattern); |
| 46 |
expectedmatch = null; |
| 47 |
addThis(); |
| 48 |
|
| 49 |
status = inSection(4); |
| 50 |
string = '`'; |
| 51 |
pattern = new RegExp('@', 'i'); |
| 52 |
print(string + ' ' + pattern); |
| 53 |
actualmatch = string.match(pattern); |
| 54 |
print('z ' + actualmatch); |
| 55 |
print('`'.match(/@/i)); |
| 56 |
expectedmatch = null; |
| 57 |
addThis(); |
| 58 |
|
| 59 |
|
| 60 |
//----------------------------------------------------------------------------- |
| 61 |
test(); |
| 62 |
//----------------------------------------------------------------------------- |
| 63 |
|
| 64 |
function addThis() |
| 65 |
{ |
| 66 |
statusmessages[i] = status; |
| 67 |
patterns[i] = pattern; |
| 68 |
strings[i] = string; |
| 69 |
actualmatches[i] = actualmatch; |
| 70 |
expectedmatches[i] = expectedmatch; |
| 71 |
i++; |
| 72 |
} |
| 73 |
|
| 74 |
|
| 75 |
function test() |
| 76 |
{ |
| 77 |
printBugNumber(BUGNUMBER); |
| 78 |
printStatus (summary); |
| 79 |
testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); |
| 80 |
} |