Imported Upstream version 1.0.0
[platform/upstream/js.git] / js / src / tests / ecma_3_1 / RegExp / regress-305064.js
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4  *
5  * The contents of this file are subject to the Mozilla Public License Version
6  * 1.1 (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  * http://www.mozilla.org/MPL/
9  *
10  * Software distributed under the License is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12  * for the specific language governing rights and limitations under the
13  * License.
14  *
15  * The Original Code is JavaScript Engine testing utilities.
16  *
17  * The Initial Developer of the Original Code is
18  * Mozilla Foundation.
19  * Portions created by the Initial Developer are Copyright (C) 2008
20  * the Initial Developer. All Rights Reserved.
21  *
22  * Contributor(s): Mike Kaplinskiy
23  *
24  * Alternatively, the contents of this file may be used under the terms of
25  * either the GNU General Public License Version 2 or later (the "GPL"), or
26  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27  * in which case the provisions of the GPL or the LGPL are applicable instead
28  * of those above. If you wish to allow use of your version of this file only
29  * under the terms of either the GPL or the LGPL, and not to allow others to
30  * use your version of this file under the terms of the MPL, indicate your
31  * decision by deleting the provisions above and replace them with the notice
32  * and other provisions required by the GPL or the LGPL. If you do not delete
33  * the provisions above, a recipient may use your version of this file under
34  * the terms of any one of the MPL, the GPL or the LGPL.
35  *
36  * ***** END LICENSE BLOCK ***** */
37
38 //-----------------------------------------------------------------------------
39 var BUGNUMBER = 305064;
40 var summary = 'CharacterClassEscape \\s';
41 var actual = '';
42 var expect = '';
43
44 //-----------------------------------------------------------------------------
45 test();
46 //-----------------------------------------------------------------------------
47
48 function test()
49 {
50   enterFunc ('test');
51   printBugNumber(BUGNUMBER);
52   printStatus (summary);
53
54   /** List from ES 3.1 Recommendation for String.trim (bug 305064) **/
55   var whitespace = [
56     {s : '\u0009', t : 'HORIZONTAL TAB'},
57     {s : '\u000B', t : 'VERTICAL TAB'},
58     {s : '\u000C', t : 'FORMFEED'},
59     {s : '\u0020', t : 'SPACE'},
60     {s : '\u00A0', t : 'NO-BREAK SPACE'},
61     {s : '\u1680', t : 'OGHAM SPACE MARK'},
62     {s : '\u180E', t : 'MONGOLIAN VOWEL SEPARATOR'},
63     {s : '\u2000', t : 'EN QUAD'},
64     {s : '\u2001', t : 'EM QUAD'},
65     {s : '\u2002', t : 'EN SPACE'},
66     {s : '\u2003', t : 'EM SPACE'},
67     {s : '\u2004', t : 'THREE-PER-EM SPACE'},
68     {s : '\u2005', t : 'FOUR-PER-EM SPACE'},
69     {s : '\u2006', t : 'SIX-PER-EM SPACE'},
70     {s : '\u2007', t : 'FIGURE SPACE'},
71     {s : '\u2008', t : 'PUNCTUATION SPACE'},
72     {s : '\u2009', t : 'THIN SPACE'},
73     {s : '\u200A', t : 'HAIR SPACE'},
74     {s : '\u202F', t : 'NARROW NO-BREAK SPACE'},
75     {s : '\u205F', t : 'MEDIUM MATHEMATICAL SPACE'},
76     {s : '\u3000', t : 'IDEOGRAPHIC SPACE'},
77     {s : '\u000A', t : 'LINE FEED OR NEW LINE'},
78     {s : '\u000D', t : 'CARRIAGE RETURN'},
79     {s : '\u2028', t : 'LINE SEPARATOR'},
80     {s : '\u2029', t : 'PARAGRAPH SEPARATOR'},
81     {s : '\u200B', t : 'ZERO WIDTH SPACE (category Cf)'}
82     ];
83
84   for (var i = 0; i < whitespace.length; ++i)
85   {
86     var v = whitespace[i];
87     reportCompare(true, !!(/\s/.test(v.s)), 'Is ' + v.t + ' a space');
88   }
89  
90   exitFunc ('test');
91 }