js/src/tests/ecma_5/RegExp/regexp-space-character-class.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/. */
     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 = '';
    14 //-----------------------------------------------------------------------------
    15 test();
    16 //-----------------------------------------------------------------------------
    18 function test()
    19 {
    20 enterFunc ('test');
    21 printBugNumber(BUGNUMBER);
    22 printStatus (summary);
    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);
    31 var non_space_chars = [ "\u200b", "\u200c", "\u200d" ];
    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(',');
    38 var actual = chars.map(function(ch) { return /\s/.test(ch); }).join(',');
    39 reportCompare(expect, actual, summary);
    41 jit(true);
    42 var actual = chars.map(function(ch) { return /\s/.test(ch); }).join(',');
    43 reportCompare(expect, actual, summary);
    44 jit(false);
    46 exitFunc ('test');
    47 }

mercurial