|
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 = 'regexp-space-character-class.js'; |
|
7 //----------------------------------------------------------------------------- |
|
8 var BUGNUMBER = 514808; |
|
9 var summary = 'Correct space character class in regexes'; |
|
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 spaces = [ "\u0009", "\u000b", "\u000c", "\u0020", "\u00a0", "\u1680", |
|
25 "\u180e", "\u2000", "\u2001", "\u2002", "\u2003", "\u2004", |
|
26 "\u2005", "\u2006", "\u2007", "\u2008", "\u2009", "\u200a", |
|
27 "\u202f", "\u205f", "\u3000", "\ufeff" ]; |
|
28 var line_terminators = [ "\u2028", "\u2029", "\u000a", "\u000d" ]; |
|
29 var space_chars = [].concat(spaces, line_terminators); |
|
30 |
|
31 var non_space_chars = [ "\u200b", "\u200c", "\u200d" ]; |
|
32 |
|
33 var chars = [].concat(space_chars, non_space_chars); |
|
34 var is_space = [].concat(space_chars.map(function(ch) { return true; }), |
|
35 non_space_chars.map(function(ch) { return false; })); |
|
36 var expect = is_space.join(','); |
|
37 |
|
38 var actual = chars.map(function(ch) { return /\s/.test(ch); }).join(','); |
|
39 reportCompare(expect, actual, summary); |
|
40 |
|
41 jit(true); |
|
42 var actual = chars.map(function(ch) { return /\s/.test(ch); }).join(','); |
|
43 reportCompare(expect, actual, summary); |
|
44 jit(false); |
|
45 |
|
46 exitFunc ('test'); |
|
47 } |