Debian Codegraph @

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