1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma_3/RegExp/regress-465862.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,84 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +//----------------------------------------------------------------------------- 1.10 +var BUGNUMBER = 465862; 1.11 +var summary = 'Do case-insensitive matching correctly in JIT for non-ASCII-letters'; 1.12 + 1.13 +var i = 0; 1.14 +var status = ''; 1.15 +var statusmessages = new Array(); 1.16 +var pattern = ''; 1.17 +var patterns = new Array(); 1.18 +var string = ''; 1.19 +var strings = new Array(); 1.20 +var actualmatch = ''; 1.21 +var actualmatches = new Array(); 1.22 +var expectedmatch = ''; 1.23 +var expectedmatches = new Array(); 1.24 + 1.25 +// Note: we must call the RegExp constructor here instead of using 1.26 +// literals. Otherwise, because the regexps are compiled at parse 1.27 +// time, they will not be compiled to native code and we will not 1.28 +// actually be testing jitted regexps. 1.29 + 1.30 +jit(true); 1.31 + 1.32 +status = inSection(1); 1.33 +string = '@'; 1.34 +pattern = new RegExp('@', 'i'); 1.35 +actualmatch = string.match(pattern); 1.36 +expectedmatch = Array(string); 1.37 +addThis(); 1.38 + 1.39 +status = inSection(2); 1.40 +string = '`'; 1.41 +pattern = new RegExp('`', 'i'); 1.42 +actualmatch = string.match(pattern); 1.43 +expectedmatch = Array(string); 1.44 +addThis(); 1.45 + 1.46 +status = inSection(3); 1.47 +string = '@'; 1.48 +pattern = new RegExp('`', 'i'); 1.49 +actualmatch = string.match(pattern); 1.50 +expectedmatch = null; 1.51 +addThis(); 1.52 + 1.53 +status = inSection(4); 1.54 +string = '`'; 1.55 +pattern = new RegExp('@', 'i'); 1.56 +print(string + ' ' + pattern); 1.57 +actualmatch = string.match(pattern); 1.58 +print('z ' + actualmatch); 1.59 +print('`'.match(/@/i)); 1.60 +expectedmatch = null; 1.61 +addThis(); 1.62 + 1.63 +jit(false); 1.64 + 1.65 +//----------------------------------------------------------------------------- 1.66 +test(); 1.67 +//----------------------------------------------------------------------------- 1.68 + 1.69 +function addThis() 1.70 +{ 1.71 + statusmessages[i] = status; 1.72 + patterns[i] = pattern; 1.73 + strings[i] = string; 1.74 + actualmatches[i] = actualmatch; 1.75 + expectedmatches[i] = expectedmatch; 1.76 + i++; 1.77 +} 1.78 + 1.79 + 1.80 +function test() 1.81 +{ 1.82 + enterFunc ('test'); 1.83 + printBugNumber(BUGNUMBER); 1.84 + printStatus (summary); 1.85 + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); 1.86 + exitFunc ('test'); 1.87 +}