1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma_3/RegExp/regress-72964.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,87 @@ 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 + * Date: 2001-07-17 1.11 + * 1.12 + * SUMMARY: Regression test for Bugzilla bug 72964: 1.13 + * "String method for pattern matching failed for Chinese Simplified (GB2312)" 1.14 + * 1.15 + * See http://bugzilla.mozilla.org/show_bug.cgi?id=72964 1.16 + */ 1.17 +//----------------------------------------------------------------------------- 1.18 +var i = 0; 1.19 +var BUGNUMBER = 72964; 1.20 +var summary = 'Testing regular expressions containing non-Latin1 characters'; 1.21 +var cnSingleSpace = ' '; 1.22 +var status = ''; 1.23 +var statusmessages = new Array(); 1.24 +var pattern = ''; 1.25 +var patterns = new Array(); 1.26 +var string = ''; 1.27 +var strings = new Array(); 1.28 +var actualmatch = ''; 1.29 +var actualmatches = new Array(); 1.30 +var expectedmatch = ''; 1.31 +var expectedmatches = new Array(); 1.32 + 1.33 + 1.34 +pattern = /[\S]+/; 1.35 +// 4 low Unicode chars = Latin1; whole string should match 1.36 +status = inSection(1); 1.37 +string = '\u00BF\u00CD\u00BB\u00A7'; 1.38 +actualmatch = string.match(pattern); 1.39 +expectedmatch = Array(string); 1.40 +addThis(); 1.41 + 1.42 +// Now put a space in the middle; first half of string should match 1.43 +status = inSection(2); 1.44 +string = '\u00BF\u00CD \u00BB\u00A7'; 1.45 +actualmatch = string.match(pattern); 1.46 +expectedmatch = Array('\u00BF\u00CD'); 1.47 +addThis(); 1.48 + 1.49 + 1.50 +// 4 high Unicode chars = non-Latin1; whole string should match 1.51 +status = inSection(3); 1.52 +string = '\u4e00\uac00\u4e03\u4e00'; 1.53 +actualmatch = string.match(pattern); 1.54 +expectedmatch = Array(string); 1.55 +addThis(); 1.56 + 1.57 +// Now put a space in the middle; first half of string should match 1.58 +status = inSection(4); 1.59 +string = '\u4e00\uac00 \u4e03\u4e00'; 1.60 +actualmatch = string.match(pattern); 1.61 +expectedmatch = Array('\u4e00\uac00'); 1.62 +addThis(); 1.63 + 1.64 + 1.65 + 1.66 +//----------------------------------------------------------------------------- 1.67 +test(); 1.68 +//----------------------------------------------------------------------------- 1.69 + 1.70 + 1.71 + 1.72 +function addThis() 1.73 +{ 1.74 + statusmessages[i] = status; 1.75 + patterns[i] = pattern; 1.76 + strings[i] = string; 1.77 + actualmatches[i] = actualmatch; 1.78 + expectedmatches[i] = expectedmatch; 1.79 + i++; 1.80 +} 1.81 + 1.82 + 1.83 +function test() 1.84 +{ 1.85 + enterFunc ('test'); 1.86 + printBugNumber(BUGNUMBER); 1.87 + printStatus (summary); 1.88 + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); 1.89 + exitFunc ('test'); 1.90 +}