michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: var gTestfile = 'regexp-space-character-class.js'; michael@0: //----------------------------------------------------------------------------- michael@0: var BUGNUMBER = 514808; michael@0: var summary = 'Correct space character class in regexes'; michael@0: var actual = ''; michael@0: var expect = ''; michael@0: michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: test(); michael@0: //----------------------------------------------------------------------------- michael@0: michael@0: function test() michael@0: { michael@0: enterFunc ('test'); michael@0: printBugNumber(BUGNUMBER); michael@0: printStatus (summary); michael@0: michael@0: var spaces = [ "\u0009", "\u000b", "\u000c", "\u0020", "\u00a0", "\u1680", michael@0: "\u180e", "\u2000", "\u2001", "\u2002", "\u2003", "\u2004", michael@0: "\u2005", "\u2006", "\u2007", "\u2008", "\u2009", "\u200a", michael@0: "\u202f", "\u205f", "\u3000", "\ufeff" ]; michael@0: var line_terminators = [ "\u2028", "\u2029", "\u000a", "\u000d" ]; michael@0: var space_chars = [].concat(spaces, line_terminators); michael@0: michael@0: var non_space_chars = [ "\u200b", "\u200c", "\u200d" ]; michael@0: michael@0: var chars = [].concat(space_chars, non_space_chars); michael@0: var is_space = [].concat(space_chars.map(function(ch) { return true; }), michael@0: non_space_chars.map(function(ch) { return false; })); michael@0: var expect = is_space.join(','); michael@0: michael@0: var actual = chars.map(function(ch) { return /\s/.test(ch); }).join(','); michael@0: reportCompare(expect, actual, summary); michael@0: michael@0: jit(true); michael@0: var actual = chars.map(function(ch) { return /\s/.test(ch); }).join(','); michael@0: reportCompare(expect, actual, summary); michael@0: jit(false); michael@0: michael@0: exitFunc ('test'); michael@0: }