Debian Codegraph @

rhino/testsrc/tests/ecma_3/RegExp/regress-72964.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 * Date: 2001-07-17
8 *
9 * SUMMARY: Regression test for Bugzilla bug 72964:
10 * "String method for pattern matching failed for Chinese Simplified (GB2312)"
11 *
12 * See http://bugzilla.mozilla.org/show_bug.cgi?id=72964
13 */
14 //-----------------------------------------------------------------------------
15 var gTestfile = 'regress-72964.js';
16 var i = 0;
17 var BUGNUMBER = 72964;
18 var summary = 'Testing regular expressions containing non-Latin1 characters';
19 var cnSingleSpace = ' ';
20 var status = '';
21 var statusmessages = new Array();
22 var pattern = '';
23 var patterns = new Array();
24 var string = '';
25 var strings = new Array();
26 var actualmatch = '';
27 var actualmatches = new Array();
28 var expectedmatch = '';
29 var expectedmatches = new Array();
30
31
32 pattern = /[\S]+/;
33 // 4 low Unicode chars = Latin1; whole string should match
34 status = inSection(1);
35 string = '\u00BF\u00CD\u00BB\u00A7';
36 actualmatch = string.match(pattern);
37 expectedmatch = Array(string);
38 addThis();
39
40 // Now put a space in the middle; first half of string should match
41 status = inSection(2);
42 string = '\u00BF\u00CD \u00BB\u00A7';
43 actualmatch = string.match(pattern);
44 expectedmatch = Array('\u00BF\u00CD');
45 addThis();
46
47
48 // 4 high Unicode chars = non-Latin1; whole string should match
49 status = inSection(3);
50 string = '\u4e00\uac00\u4e03\u4e00';
51 actualmatch = string.match(pattern);
52 expectedmatch = Array(string);
53 addThis();
54
55 // Now put a space in the middle; first half of string should match
56 status = inSection(4);
57 string = '\u4e00\uac00 \u4e03\u4e00';
58 actualmatch = string.match(pattern);
59 expectedmatch = Array('\u4e00\uac00');
60 addThis();
61
62
63
64 //-----------------------------------------------------------------------------
65 test();
66 //-----------------------------------------------------------------------------
67
68
69
70 function addThis()
71 {
72 statusmessages[i] = status;
73 patterns[i] = pattern;
74 strings[i] = string;
75 actualmatches[i] = actualmatch;
76 expectedmatches[i] = expectedmatch;
77 i++;
78 }
79
80
81 function test()
82 {
83 enterFunc ('test');
84 printBugNumber(BUGNUMBER);
85 printStatus (summary);
86 testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
87 exitFunc ('test');
88 }