]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_2/RegExp/properties-002.js
2 * File Name: RegExp/properties-002.js
3 * ECMA Section: 15.7.6.js
4 * Description: Based on ECMA 2 Draft 7 February 1999
6 * Author: christine@netscape.com
7 * Date: 19 February 1999
9 //-----------------------------------------------------------------------------
10 var SECTION
= "RegExp/properties-002.js";
11 var VERSION
= "ECMA_2";
12 var TITLE
= "Properties of RegExp Instances";
13 var BUGNUMBER
="http://scopus/bugsplat/show_bug.cgi?id=346032";
14 // ALSO SEE http://bugzilla.mozilla.org/show_bug.cgi?id=124339
20 re_1
.lastIndex
= Math
.pow(2,31);
21 AddRegExpCases( re_1
, "\\cA?", true, false, false, Math
.pow(2,31) );
24 re_2
.lastIndex
= Math
.pow(2,32) -1;
25 AddRegExpCases( re_2
, "\\w*", false, true, false, Math
.pow(2,32)-1 );
28 re_3
.lastIndex
= Math
.pow(2,31) -1;
29 AddRegExpCases( re_3
, "\\*{0,80}", false, false, true, Math
.pow(2,31) -1 );
32 re_4
.lastIndex
= Math
.pow(2,30) -1;
33 AddRegExpCases( re_4
, "^.", true, true, true, Math
.pow(2,30) -1 );
36 re_5
.lastIndex
= Math
.pow(2,30);
37 AddRegExpCases( re_5
, "\\B", false, false, false, Math
.pow(2,30) );
40 * Brendan: "need to test cases Math.pow(2,32) and greater to see
41 * whether they round-trip." Reason: thanks to the work done in
42 * http://bugzilla.mozilla.org/show_bug.cgi?id=124339, lastIndex
43 * is now stored as a double instead of a uint32 (unsigned integer).
45 * Note 2^32 -1 is the upper bound for uint32's, but doubles can go
46 * all the way up to Number.MAX_VALUE. So that's why we need cases
47 * between those two numbers.
51 re_6
.lastIndex
= Math
.pow(2,32);
52 AddRegExpCases( re_6
, "\\B", false, false, false, Math
.pow(2,32) );
55 re_7
.lastIndex
= Math
.pow(2,32) + 1;
56 AddRegExpCases( re_7
, "\\B", false, false, false, Math
.pow(2,32) + 1 );
59 re_8
.lastIndex
= Math
.pow(2,32) * 2;
60 AddRegExpCases( re_8
, "\\B", false, false, false, Math
.pow(2,32) * 2 );
63 re_9
.lastIndex
= Math
.pow(2,40);
64 AddRegExpCases( re_9
, "\\B", false, false, false, Math
.pow(2,40) );
67 re_10
.lastIndex
= Number
.MAX_VALUE
;
68 AddRegExpCases( re_10
, "\\B", false, false, false, Number
.MAX_VALUE
);
72 //-----------------------------------------------------------------------------
74 //-----------------------------------------------------------------------------
78 function AddRegExpCases( re
, s
, g
, i
, m
, l
){
80 AddTestCase( re
+ ".test == RegExp.prototype.test",
82 re
.test
== RegExp
.prototype.test
);
84 AddTestCase( re
+ ".toString == RegExp.prototype.toString",
86 re
.toString
== RegExp
.prototype.toString
);
88 AddTestCase( re
+ ".contructor == RegExp.prototype.constructor",
90 re
.constructor == RegExp
.prototype.constructor );
92 AddTestCase( re
+ ".compile == RegExp.prototype.compile",
94 re
.compile
== RegExp
.prototype.compile
);
96 AddTestCase( re
+ ".exec == RegExp.prototype.exec",
98 re
.exec
== RegExp
.prototype.exec
);
102 AddTestCase( re
+ ".source",
106 AddTestCase( re
+ ".toString()",
107 "/" + s
+"/" + (g
?"g":"") + (i
?"i":"") +(m
?"m":""),
110 AddTestCase( re
+ ".global",
114 AddTestCase( re
+ ".ignoreCase",
118 AddTestCase( re
+ ".multiline",
122 AddTestCase( re
+ ".lastIndex",