summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/tests/mozilla/js1_2
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-10-21 07:00:00 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2008-10-21 07:00:00 -0700
commit9364f22aed35e1a1e9d07c121510f80be3ab0502 (patch)
treed49911209b132da58d838efa852daf28d516df21 /JavaScriptCore/tests/mozilla/js1_2
parent87eb0cb35bad8784770ebc807e6c982432e47107 (diff)
downloadexternal_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.zip
external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.tar.gz
external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.tar.bz2
Initial Contribution
Diffstat (limited to 'JavaScriptCore/tests/mozilla/js1_2')
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/Array/array_split_1.js72
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/Array/general1.js62
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/Array/general2.js78
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/Array/slice.js123
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/Array/splice1.js152
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/Array/splice2.js150
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/Array/tostring_1.js138
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/Array/tostring_2.js96
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/Objects/toString-001.js117
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/String/charCodeAt.js71
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/String/concat.js96
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/String/match.js62
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/String/slice.js123
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/browser.js83
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/function/Function_object.js85
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/function/Number.js98
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/function/String.js99
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/function/definition-1.js73
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/function/function-001-n.js74
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/function/length.js93
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/function/nesting-1.js61
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/function/nesting.js83
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/function/regexparg-1.js98
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/function/regexparg-2-n.js66
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/function/tostring-1.js143
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/function/tostring-2.js185
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/jsref.js215
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/operator/equality.js72
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/operator/strictEquality.js92
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_dollar_number.js108
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input.js102
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input_as_array.js102
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastIndex.js83
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch.js85
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch_as_array.js85
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen.js100
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen_as_array.js100
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext.js90
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext_as_array.js90
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline.js129
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline_as_array.js129
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_object.js88
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext.js90
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext_as_array.js90
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/alphanumeric.js129
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/asterisk.js105
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/backslash.js79
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/backspace.js79
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/beginLine.js80
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/character_class.js107
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/compile.js94
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/control_characters.js71
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/digit.js119
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/dot.js95
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/endLine.js80
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/everything.js80
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/exec.js77
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/flags.js84
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/global.js95
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/hexadecimal.js108
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/ignoreCase.js111
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/interval.js115
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/octal.js108
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/parentheses.js107
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/plus.js87
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/question_mark.js99
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/regress-6359.js68
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/regress-9141.js86
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/simple_form.js90
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/source.js87
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/special_characters.js157
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/string_replace.js80
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/string_search.js87
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/string_split.js91
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/test.js87
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/toString.js75
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/vertical_bar.js95
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/whitespace.js122
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regexp/word_boundary.js119
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regress/regress-144834.js76
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/regress/regress-7703.js83
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/shell.js147
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/statements/break.js162
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/statements/continue.js175
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/statements/do_while.js68
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/statements/switch.js127
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/statements/switch2.js188
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/version120/boolean-001.js73
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/version120/regress-99663.js172
-rw-r--r--JavaScriptCore/tests/mozilla/js1_2/version120/shell.js24
90 files changed, 9079 insertions, 0 deletions
diff --git a/JavaScriptCore/tests/mozilla/js1_2/Array/array_split_1.js b/JavaScriptCore/tests/mozilla/js1_2/Array/array_split_1.js
new file mode 100644
index 0000000..4076111
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/Array/array_split_1.js
@@ -0,0 +1,72 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: array_split_1.js
+ ECMA Section: Array.split()
+ Description:
+
+ These are tests from free perl suite.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "Free Perl";
+ var VERSION = "JS1_2";
+ var TITLE = "Array.split()";
+
+ startTest();
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "('a,b,c'.split(',')).length",
+ 3,
+ ('a,b,c'.split(',')).length );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "('a,b'.split(',')).length",
+ 2,
+ ('a,b'.split(',')).length );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "('a'.split(',')).length",
+ 1,
+ ('a'.split(',')).length );
+
+/*
+ * Mozilla deviates from ECMA by never splitting an empty string by any separator
+ * string into a non-empty array (an array of length 1 that contains the empty string).
+ * But Internet Explorer does not do this, so we won't do it in JavaScriptCore either.
+ */
+ testcases[tc++] = new TestCase( SECTION,
+ "(''.split(',')).length",
+ 1,
+ (''.split(',')).length );
+
+
+
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/Array/general1.js b/JavaScriptCore/tests/mozilla/js1_2/Array/general1.js
new file mode 100644
index 0000000..7762ec4
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/Array/general1.js
@@ -0,0 +1,62 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: general1.js
+ Description: 'This tests out some of the functionality on methods on the Array objects'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String:push,unshift,shift';
+
+ writeHeaderToLog('Executing script: general1.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ var array1 = [];
+
+ array1.push(123); //array1 = [123]
+ array1.push("dog"); //array1 = [123,dog]
+ array1.push(-99); //array1 = [123,dog,-99]
+ array1.push("cat"); //array1 = [123,dog,-99,cat]
+ testcases[count++] = new TestCase( SECTION, "array1.pop()", array1.pop(),'cat');
+ //array1 = [123,dog,-99]
+ array1.push("mouse"); //array1 = [123,dog,-99,mouse]
+ testcases[count++] = new TestCase( SECTION, "array1.shift()", array1.shift(),123);
+ //array1 = [dog,-99,mouse]
+ array1.unshift(96); //array1 = [96,dog,-99,mouse]
+ testcases[count++] = new TestCase( SECTION, "state of array", String([96,"dog",-99,"mouse"]), String(array1));
+ testcases[count++] = new TestCase( SECTION, "array1.length", array1.length,4);
+ array1.shift(); //array1 = [dog,-99,mouse]
+ array1.shift(); //array1 = [-99,mouse]
+ array1.shift(); //array1 = [mouse]
+ testcases[count++] = new TestCase( SECTION, "array1.shift()", array1.shift(),"mouse");
+ testcases[count++] = new TestCase( SECTION, "array1.shift()", "undefined", String(array1.shift()));
+
+ test();
+
diff --git a/JavaScriptCore/tests/mozilla/js1_2/Array/general2.js b/JavaScriptCore/tests/mozilla/js1_2/Array/general2.js
new file mode 100644
index 0000000..afa4529
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/Array/general2.js
@@ -0,0 +1,78 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: general2.js
+ Description: 'This tests out some of the functionality on methods on the Array objects'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String:push,splice,concat,unshift,sort';
+
+ writeHeaderToLog('Executing script: general2.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ array1 = new Array();
+ array2 = [];
+ size = 10;
+
+ // this for loop populates array1 and array2 as follows:
+ // array1 = [0,1,2,3,4,....,size - 2,size - 1]
+ // array2 = [size - 1, size - 2,...,4,3,2,1,0]
+ for (var i = 0; i < size; i++)
+ {
+ array1.push(i);
+ array2.push(size - 1 - i);
+ }
+
+ // the following for loop reverses the order of array1 so
+ // that it should be similarly ordered to array2
+ for (i = array1.length; i > 0; i--)
+ {
+ array3 = array1.slice(1,i);
+ array1.splice(1,i-1);
+ array1 = array3.concat(array1);
+ }
+
+ // the following for loop reverses the order of array1
+ // and array2
+ for (i = 0; i < size; i++)
+ {
+ array1.push(array1.shift());
+ array2.unshift(array2.pop());
+ }
+
+ testcases[count++] = new TestCase( SECTION, "Array.push,pop,shift,unshift,slice,splice", true,String(array1) == String(array2));
+ array1.sort();
+ array2.sort();
+ testcases[count++] = new TestCase( SECTION, "Array.sort", true,String(array1) == String(array2));
+
+ test();
+
diff --git a/JavaScriptCore/tests/mozilla/js1_2/Array/slice.js b/JavaScriptCore/tests/mozilla/js1_2/Array/slice.js
new file mode 100644
index 0000000..7b9c55d
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/Array/slice.js
@@ -0,0 +1,123 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: slice.js
+ Description: 'This tests out some of the functionality on methods on the Array objects'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String:slice';
+
+ writeHeaderToLog('Executing script: slice.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ function mySlice(a, from, to)
+ {
+ var from2 = from;
+ var to2 = to;
+ var returnArray = [];
+ var i;
+
+ if (from2 < 0) from2 = a.length + from;
+ if (to2 < 0) to2 = a.length + to;
+
+ if ((to2 > from2)&&(to2 > 0)&&(from2 < a.length))
+ {
+ if (from2 < 0) from2 = 0;
+ if (to2 > a.length) to2 = a.length;
+
+ for (i = from2; i < to2; ++i) returnArray.push(a[i]);
+ }
+ return returnArray;
+ }
+
+ // This function tests the slice command on an Array
+ // passed in. The arguments passed into slice range in
+ // value from -5 to the length of the array + 4. Every
+ // combination of the two arguments is tested. The expected
+ // result of the slice(...) method is calculated and
+ // compared to the actual result from the slice(...) method.
+ // If the Arrays are not similar false is returned.
+ function exhaustiveSliceTest(testname, a)
+ {
+ var x = 0;
+ var y = 0;
+ var errorMessage;
+ var reason = "";
+ var passed = true;
+
+ for (x = -(2 + a.length); x <= (2 + a.length); x++)
+ for (y = (2 + a.length); y >= -(2 + a.length); y--)
+ {
+ var b = a.slice(x,y);
+ var c = mySlice(a,x,y);
+
+ if (String(b) != String(c))
+ {
+ errorMessage =
+ "ERROR: 'TEST FAILED' ERROR: 'TEST FAILED' ERROR: 'TEST FAILED'\n" +
+ " test: " + "a.slice(" + x + "," + y + ")\n" +
+ " a: " + String(a) + "\n" +
+ " actual result: " + String(b) + "\n" +
+ " expected result: " + String(c) + "\n";
+ writeHeaderToLog(errorMessage);
+ reason = reason + errorMessage;
+ passed = false;
+ }
+ }
+ var testCase = new TestCase(SECTION, testname, true, passed);
+ if (passed == false)
+ testCase.reason = reason;
+ return testCase;
+ }
+
+ var a = ['a','test string',456,9.34,new String("string object"),[],['h','i','j','k']];
+ var b = [1,2,3,4,5,6,7,8,9,0];
+
+ testcases[count++] = exhaustiveSliceTest("exhaustive slice test 1", a);
+ testcases[count++] = exhaustiveSliceTest("exhaustive slice test 2", b);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/JavaScriptCore/tests/mozilla/js1_2/Array/splice1.js b/JavaScriptCore/tests/mozilla/js1_2/Array/splice1.js
new file mode 100644
index 0000000..b2164f4
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/Array/splice1.js
@@ -0,0 +1,152 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: splice1.js
+ Description: 'Tests Array.splice(x,y) w/no var args'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String:splice 1';
+ var BUGNUMBER="123795";
+
+ writeHeaderToLog('Executing script: splice1.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ function mySplice(testArray, splicedArray, first, len, elements)
+ {
+ var removedArray = [];
+ var adjustedFirst = first;
+ var adjustedLen = len;
+
+ if (adjustedFirst < 0) adjustedFirst = testArray.length + first;
+ if (adjustedFirst < 0) adjustedFirst = 0;
+
+ if (adjustedLen < 0) adjustedLen = 0;
+
+ for (i = 0; (i < adjustedFirst)&&(i < testArray.length); ++i)
+ splicedArray.push(testArray[i]);
+
+ if (adjustedFirst < testArray.length)
+ for (i = adjustedFirst; (i < adjustedFirst + adjustedLen) &&
+ (i < testArray.length); ++i)
+ {
+ removedArray.push(testArray[i]);
+ }
+
+ for (i = 0; i < elements.length; i++) splicedArray.push(elements[i]);
+
+ for (i = adjustedFirst + adjustedLen; i < testArray.length; i++)
+ splicedArray.push(testArray[i]);
+
+ return removedArray;
+ }
+
+ function exhaustiveSpliceTest(testname, testArray)
+ {
+ var errorMessage;
+ var passed = true;
+ var reason = "";
+
+ for (var first = -(testArray.length+2); first <= 2 + testArray.length; first++)
+ {
+ var actualSpliced = [];
+ var expectedSpliced = [];
+ var actualRemoved = [];
+ var expectedRemoved = [];
+
+ for (var len = 0; len < testArray.length + 2; len++)
+ {
+ actualSpliced = [];
+ expectedSpliced = [];
+
+ for (var i = 0; i < testArray.length; ++i)
+ actualSpliced.push(testArray[i]);
+
+ actualRemoved = actualSpliced.splice(first,len);
+ expectedRemoved = mySplice(testArray,expectedSpliced,first,len,[]);
+
+ var adjustedFirst = first;
+ if (adjustedFirst < 0) adjustedFirst = testArray.length + first;
+ if (adjustedFirst < 0) adjustedFirst = 0;
+
+ if ( (String(actualSpliced) != String(expectedSpliced))
+ ||(String(actualRemoved) != String(expectedRemoved)))
+ {
+ if ( (String(actualSpliced) == String(expectedSpliced))
+ &&(String(actualRemoved) != String(expectedRemoved)) )
+ {
+ if ( (expectedRemoved.length == 1)
+ &&(String(actualRemoved) == String(expectedRemoved[0]))) continue;
+ if ( expectedRemoved.length == 0 && actualRemoved == void 0) continue;
+ }
+
+ errorMessage =
+ "ERROR: 'TEST FAILED'\n" +
+ " test: " + "a.splice(" + first + "," + len + ",-97,new String('test arg'),[],9.8)\n" +
+ " a: " + String(testArray) + "\n" +
+ " actual spliced: " + String(actualSpliced) + "\n" +
+ " expected spliced: " + String(expectedSpliced) + "\n" +
+ " actual removed: " + String(actualRemoved) + "\n" +
+ " expected removed: " + String(expectedRemoved) + "\n";
+ writeHeaderToLog(errorMessage);
+ reason = reason + errorMessage;
+ passed = false;
+ }
+ }
+ }
+ var testcase = new TestCase( SECTION, testname, true, passed);
+ if (!passed)
+ testcase.reason = reason;
+ return testcase;
+ }
+
+ var a = ['a','test string',456,9.34,new String("string object"),[],['h','i','j','k']];
+ var b = [1,2,3,4,5,6,7,8,9,0];
+
+ testcases[count++] = exhaustiveSpliceTest("exhaustive splice w/no optional args 1",a);
+ testcases[count++] = exhaustiveSpliceTest("exhaustive splice w/no optional args 1",b);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/JavaScriptCore/tests/mozilla/js1_2/Array/splice2.js b/JavaScriptCore/tests/mozilla/js1_2/Array/splice2.js
new file mode 100644
index 0000000..30861a5
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/Array/splice2.js
@@ -0,0 +1,150 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: splice2.js
+ Description: 'Tests Array.splice(x,y) w/4 var args'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String:splice 2';
+ var BUGNUMBER="123795";
+
+ writeHeaderToLog('Executing script: splice2.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ function mySplice(testArray, splicedArray, first, len, elements)
+ {
+ var removedArray = [];
+ var adjustedFirst = first;
+ var adjustedLen = len;
+
+ if (adjustedFirst < 0) adjustedFirst = testArray.length + first;
+ if (adjustedFirst < 0) adjustedFirst = 0;
+
+ if (adjustedLen < 0) adjustedLen = 0;
+
+ for (i = 0; (i < adjustedFirst)&&(i < testArray.length); ++i)
+ splicedArray.push(testArray[i]);
+
+ if (adjustedFirst < testArray.length)
+ for (i = adjustedFirst; (i < adjustedFirst + adjustedLen) && (i < testArray.length); ++i)
+ removedArray.push(testArray[i]);
+
+ for (i = 0; i < elements.length; i++) splicedArray.push(elements[i]);
+
+ for (i = adjustedFirst + adjustedLen; i < testArray.length; i++)
+ splicedArray.push(testArray[i]);
+
+ return removedArray;
+ }
+
+ function exhaustiveSpliceTestWithArgs(testname, testArray)
+ {
+ var passed = true;
+ var errorMessage;
+ var reason = "";
+ for (var first = -(testArray.length+2); first <= 2 + testArray.length; first++)
+ {
+ var actualSpliced = [];
+ var expectedSpliced = [];
+ var actualRemoved = [];
+ var expectedRemoved = [];
+
+ for (var len = 0; len < testArray.length + 2; len++)
+ {
+ actualSpliced = [];
+ expectedSpliced = [];
+
+ for (var i = 0; i < testArray.length; ++i)
+ actualSpliced.push(testArray[i]);
+
+ actualRemoved = actualSpliced.splice(first,len,-97,new String("test arg"),[],9.8);
+ expectedRemoved = mySplice(testArray,expectedSpliced,first,len,[-97,new String("test arg"),[],9.8]);
+
+ var adjustedFirst = first;
+ if (adjustedFirst < 0) adjustedFirst = testArray.length + first;
+ if (adjustedFirst < 0) adjustedFirst = 0;
+
+
+ if ( (String(actualSpliced) != String(expectedSpliced))
+ ||(String(actualRemoved) != String(expectedRemoved)))
+ {
+ if ( (String(actualSpliced) == String(expectedSpliced))
+ &&(String(actualRemoved) != String(expectedRemoved)) )
+ {
+
+ if ( (expectedRemoved.length == 1)
+ &&(String(actualRemoved) == String(expectedRemoved[0]))) continue;
+ if ( expectedRemoved.length == 0 && actualRemoved == void 0 ) continue;
+ }
+
+ errorMessage =
+ "ERROR: 'TEST FAILED' ERROR: 'TEST FAILED' ERROR: 'TEST FAILED'\n" +
+ " test: " + "a.splice(" + first + "," + len + ",-97,new String('test arg'),[],9.8)\n" +
+ " a: " + String(testArray) + "\n" +
+ " actual spliced: " + String(actualSpliced) + "\n" +
+ " expected spliced: " + String(expectedSpliced) + "\n" +
+ " actual removed: " + String(actualRemoved) + "\n" +
+ " expected removed: " + String(expectedRemoved);
+ reason = reason + errorMessage;
+ writeHeaderToLog(errorMessage);
+ passed = false;
+ }
+ }
+ }
+ var testcase = new TestCase(SECTION, testname, true, passed);
+ if (!passed) testcase.reason = reason;
+ return testcase;
+ }
+
+
+ var a = ['a','test string',456,9.34,new String("string object"),[],['h','i','j','k']];
+ var b = [1,2,3,4,5,6,7,8,9,0];
+
+ testcases[count++] = exhaustiveSpliceTestWithArgs("exhaustive splice w/2 optional args 1",a);
+ testcases[count++] = exhaustiveSpliceTestWithArgs("exhaustive splice w/2 optional args 2",b);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/JavaScriptCore/tests/mozilla/js1_2/Array/tostring_1.js b/JavaScriptCore/tests/mozilla/js1_2/Array/tostring_1.js
new file mode 100644
index 0000000..453d8ab
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/Array/tostring_1.js
@@ -0,0 +1,138 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: tostring_1.js
+ ECMA Section: Array.toString()
+ Description:
+
+ This checks the ToString value of Array objects under JavaScript 1.2.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "JS1_2";
+ var VERSION = "JS1_2";
+ startTest();
+ var TITLE = "Array.toString()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var a = new Array();
+
+ var VERSION = 0;
+
+ /* This test assumes that if version() exists, it can set the JavaScript
+ * interpreter to an arbitrary version. To prevent unhandled exceptions in
+ * other tests, testkjs implements version() as a stub function, but
+ * JavaScriptCore doesn't support setting the JavaScript engine's version.
+
+ * Commenting out the following lines forces the test to expect JavaScript
+ * 1.5 results.
+
+ * If JavaScriptCore changes to support versioning, this test should split
+ * into a 1.2 test in js1_2/ and a 1.5 test in js1_5/.
+ */
+
+ /*
+ if ( typeof version == "function" ) {
+ version(120);
+ VERSION = "120";
+ } else {
+ function version() { return 0; };
+ }
+ */
+
+ testcases[tc++] = new TestCase ( SECTION,
+ "var a = new Array(); a.toString()",
+ ( VERSION == "120" ? "[]" : "" ),
+ a.toString() );
+
+ a[0] = void 0;
+
+ testcases[tc++] = new TestCase ( SECTION,
+ "a[0] = void 0; a.toString()",
+ ( VERSION == "120" ? "[, ]" : "" ),
+ a.toString() );
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "a.length",
+ 1,
+ a.length );
+
+ a[1] = void 0;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "a[1] = void 0; a.toString()",
+ ( VERSION == "120" ? "[, , ]" : "," ),
+ a.toString() );
+
+ a[1] = "hi";
+
+ testcases[tc++] = new TestCase( SECTION,
+ "a[1] = \"hi\"; a.toString()",
+ ( VERSION == "120" ? "[, \"hi\"]" : ",hi" ),
+ a.toString() );
+
+ a[2] = void 0;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "a[2] = void 0; a.toString()",
+ ( VERSION == "120" ?"[, \"hi\", , ]":",hi,"),
+ a.toString() );
+
+ var b = new Array(1000);
+ var bstring = "";
+ for ( blen=0; blen<999; blen++) {
+ bstring += ",";
+ }
+
+
+ testcases[tc++] = new TestCase ( SECTION,
+ "var b = new Array(1000); b.toString()",
+ ( VERSION == "120" ? "[1000]" : bstring ),
+ b.toString() );
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "b.length",
+ ( VERSION == "120" ? 1 : 1000 ),
+ b.length );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/js1_2/Array/tostring_2.js b/JavaScriptCore/tests/mozilla/js1_2/Array/tostring_2.js
new file mode 100644
index 0000000..ae9542b
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/Array/tostring_2.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: tostring_2.js
+ Reference: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=114564
+ Description: toString in version 120
+
+
+ Author: christine@netscape.com
+ Date: 15 June 1998
+*/
+
+ var SECTION = "Array/tostring_2.js";
+ var VERSION = "JS_12";
+ startTest();
+ var TITLE = "Array.toString";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var a = [];
+
+ var VERSION = 0;
+
+ /* This test assumes that if version() exists, it can set the JavaScript
+ * interpreter to an arbitrary version. To prevent unhandled exceptions in
+ * other tests, testkjs implements version() as a stub function, but
+ * JavaScriptCore doesn't support setting the JavaScript engine's version.
+
+ * Commenting out the following lines forces the test to expect JavaScript
+ * 1.5 results.
+
+ * If JavaScriptCore changes to support versioning, this test should split
+ * into a 1.2 test in js1_2/ and a 1.5 test in js1_5/.
+ */
+
+ /*
+ if ( typeof version == "function" ) {
+ writeLineToLog("version 120");
+ version(120);
+ VERSION = "120";
+ } else {
+ function version() { return 0; };
+ }
+ */
+
+ testcases[tc++] = new TestCase ( SECTION,
+ "a.toString()",
+ ( VERSION == "120" ? "[]" : "" ),
+ a.toString() );
+
+ testcases[tc++] = new TestCase ( SECTION,
+ "String( a )",
+ ( VERSION == "120" ? "[]" : "" ),
+ String( a ) );
+
+ testcases[tc++] = new TestCase ( SECTION,
+ "a +''",
+ ( VERSION == "120" ? "[]" : "" ),
+ a+"" );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/js1_2/Objects/toString-001.js b/JavaScriptCore/tests/mozilla/js1_2/Objects/toString-001.js
new file mode 100644
index 0000000..33976bd
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/Objects/toString-001.js
@@ -0,0 +1,117 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: toString_1.js
+ ECMA Section: Object.toString()
+ Description:
+
+ This checks the ToString value of Object objects under JavaScript 1.2.
+
+ In JavaScript 1.2, Object.toString()
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "JS1_2";
+ var VERSION = "JS1_2";
+ startTest();
+ var TITLE = "Object.toString()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var o = new Object();
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "var o = new Object(); o.toString()",
+ "{}",
+ o.toString() );
+
+ o = {};
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "o = {}; o.toString()",
+ "{}",
+ o.toString() );
+
+ o = { name:"object", length:0, value:"hello" }
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "o = { name:\"object\", length:0, value:\"hello\" }; o.toString()",
+ true,
+ checkObjectToString(o.toString(), ['name:"object"', 'length:0',
+ 'value:"hello"']));
+
+ o = { name:"object", length:0, value:"hello",
+ toString:new Function( "return this.value+''" ) }
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "o = { name:\"object\", length:0, value:\"hello\", "+
+ "toString:new Function( \"return this.value+''\" ) }; o.toString()",
+ "hello",
+ o.toString() );
+
+
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+/**
+ * checkObjectToString
+ *
+ * In JS1.2, Object.prototype.toString returns a representation of the
+ * object's properties as a string. However, the order of the properties
+ * in the resulting string is not specified. This function compares the
+ * resulting string with an array of strings to make sure that the
+ * resulting string is some permutation of the strings in the array.
+ */
+function checkObjectToString(s, a) {
+ var m = /^\{(.*)\}$/(s);
+ if (!m)
+ return false; // should begin and end with curly brackets
+ var a2 = m[1].split(", ");
+ if (a.length != a2.length)
+ return false; // should be same length
+ a.sort();
+ a2.sort();
+ for (var i=0; i < a.length; i++) {
+ if (a[i] != a2[i])
+ return false; // should have identical elements
+ }
+ return true;
+}
+
diff --git a/JavaScriptCore/tests/mozilla/js1_2/String/charCodeAt.js b/JavaScriptCore/tests/mozilla/js1_2/String/charCodeAt.js
new file mode 100644
index 0000000..ec4a7a2
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/String/charCodeAt.js
@@ -0,0 +1,71 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: charCodeAt.js
+ Description: 'This tests new String object method: charCodeAt'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String:charCodeAt';
+
+ writeHeaderToLog('Executing script: charCodeAt.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ var aString = new String("tEs5");
+
+ testcases[count++] = new TestCase( SECTION, "aString.charCodeAt(-2)", NaN, aString.charCodeAt(-2));
+ testcases[count++] = new TestCase( SECTION, "aString.charCodeAt(-1)", NaN, aString.charCodeAt(-1));
+ testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( 0)", 116, aString.charCodeAt( 0));
+ testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( 1)", 69, aString.charCodeAt( 1));
+ testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( 2)", 115, aString.charCodeAt( 2));
+ testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( 3)", 53, aString.charCodeAt( 3));
+ testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( 4)", NaN, aString.charCodeAt( 4));
+ testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( 5)", NaN, aString.charCodeAt( 5));
+ testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( Infinity)", NaN, aString.charCodeAt( Infinity));
+ testcases[count++] = new TestCase( SECTION, "aString.charCodeAt(-Infinity)", NaN, aString.charCodeAt(-Infinity));
+ //testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( )", 116, aString.charCodeAt( ));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/JavaScriptCore/tests/mozilla/js1_2/String/concat.js b/JavaScriptCore/tests/mozilla/js1_2/String/concat.js
new file mode 100644
index 0000000..725abb7
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/String/concat.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: concat.js
+ Description: 'This tests the new String object method: concat'
+
+ Author: NickLerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String:concat';
+
+ writeHeaderToLog('Executing script: concat.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ var aString = new String("test string");
+ var bString = new String(" another ");
+
+ testcases[count++] = new TestCase( SECTION, "aString.concat(' more')", "test string more", aString.concat(' more').toString());
+ testcases[count++] = new TestCase( SECTION, "aString.concat(bString)", "test string another ", aString.concat(bString).toString());
+ testcases[count++] = new TestCase( SECTION, "aString ", "test string", aString.toString());
+ testcases[count++] = new TestCase( SECTION, "bString ", " another ", bString.toString());
+ testcases[count++] = new TestCase( SECTION, "aString.concat(345) ", "test string345", aString.concat(345).toString());
+ testcases[count++] = new TestCase( SECTION, "aString.concat(true) ", "test stringtrue", aString.concat(true).toString());
+ testcases[count++] = new TestCase( SECTION, "aString.concat(null) ", "test stringnull", aString.concat(null).toString());
+ /*
+ http://bugs.webkit.org/show_bug.cgi?id=11545#c3
+ According to ECMA 15.5.4.6, the argument of concat should send to ToString and
+ convert into a string value (not String object). So these arguments will be
+ convert into '' and '1,2,3' under ECMA-262v3, not the js1.2 expected '[]' and
+ '[1,2,3]'
+ */
+ //testcases[count++] = new TestCase( SECTION, "aString.concat([]) ", "test string[]", aString.concat([]).toString());
+ //testcases[count++] = new TestCase( SECTION, "aString.concat([1,2,3])", "test string[1, 2, 3]", aString.concat([1,2,3]).toString());
+
+ testcases[count++] = new TestCase( SECTION, "'abcde'.concat(' more')", "abcde more", 'abcde'.concat(' more').toString());
+ testcases[count++] = new TestCase( SECTION, "'abcde'.concat(bString)", "abcde another ", 'abcde'.concat(bString).toString());
+ testcases[count++] = new TestCase( SECTION, "'abcde' ", "abcde", 'abcde');
+ testcases[count++] = new TestCase( SECTION, "'abcde'.concat(345) ", "abcde345", 'abcde'.concat(345).toString());
+ testcases[count++] = new TestCase( SECTION, "'abcde'.concat(true) ", "abcdetrue", 'abcde'.concat(true).toString());
+ testcases[count++] = new TestCase( SECTION, "'abcde'.concat(null) ", "abcdenull", 'abcde'.concat(null).toString());
+ /*
+ http://bugs.webkit.org/show_bug.cgi?id=11545#c3
+ According to ECMA 15.5.4.6, the argument of concat should send to ToString and
+ convert into a string value (not String object). So these arguments will be
+ convert into '' and '1,2,3' under ECMA-262v3, not the js1.2 expected '[]' and
+ '[1,2,3]'
+ */
+ //testcases[count++] = new TestCase( SECTION, "'abcde'.concat([]) ", "abcde[]", 'abcde'.concat([]).toString());
+ //testcases[count++] = new TestCase( SECTION, "'abcde'.concat([1,2,3])", "abcde[1, 2, 3]", 'abcde'.concat([1,2,3]).toString());
+
+ //what should this do:
+ testcases[count++] = new TestCase( SECTION, "'abcde'.concat() ", "abcde", 'abcde'.concat().toString());
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/JavaScriptCore/tests/mozilla/js1_2/String/match.js b/JavaScriptCore/tests/mozilla/js1_2/String/match.js
new file mode 100644
index 0000000..6c4efb4
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/String/match.js
@@ -0,0 +1,62 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: match.js
+ Description: 'This tests the new String object method: match'
+
+ Author: NickLerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String:match';
+
+ writeHeaderToLog('Executing script: match.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ var aString = new String("this is a test string");
+
+ testcases[count++] = new TestCase( SECTION, "aString.match(/is.*test/) ", String(["is is a test"]), String(aString.match(/is.*test/)));
+ testcases[count++] = new TestCase( SECTION, "aString.match(/s.*s/) ", String(["s is a test s"]), String(aString.match(/s.*s/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/JavaScriptCore/tests/mozilla/js1_2/String/slice.js b/JavaScriptCore/tests/mozilla/js1_2/String/slice.js
new file mode 100644
index 0000000..f0e901e
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/String/slice.js
@@ -0,0 +1,123 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: slice.js
+ Description: 'This tests the String object method: slice'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String.slice';
+
+ writeHeaderToLog('Executing script: slice.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ function myStringSlice(a, from, to)
+ {
+ var from2 = from;
+ var to2 = to;
+ var returnString = new String("");
+ var i;
+
+ if (from2 < 0) from2 = a.length + from;
+ if (to2 < 0) to2 = a.length + to;
+
+ if ((to2 > from2)&&(to2 > 0)&&(from2 < a.length))
+ {
+ if (from2 < 0) from2 = 0;
+ if (to2 > a.length) to2 = a.length;
+
+ for (i = from2; i < to2; ++i) returnString += a.charAt(i);
+ }
+ return returnString;
+ }
+
+ // This function tests the slice command on a String
+ // passed in. The arguments passed into slice range in
+ // value from -5 to the length of the array + 4. Every
+ // combination of the two arguments is tested. The expected
+ // result of the slice(...) method is calculated and
+ // compared to the actual result from the slice(...) method.
+ // If the Strings are not similar false is returned.
+ function exhaustiveStringSliceTest(testname, a)
+ {
+ var x = 0;
+ var y = 0;
+ var errorMessage;
+ var reason = "";
+ var passed = true;
+
+ for (x = -(2 + a.length); x <= (2 + a.length); x++)
+ for (y = (2 + a.length); y >= -(2 + a.length); y--)
+ {
+ var b = a.slice(x,y);
+ var c = myStringSlice(a,x,y);
+
+ if (String(b) != String(c))
+ {
+ errorMessage =
+ "ERROR: 'TEST FAILED' ERROR: 'TEST FAILED' ERROR: 'TEST FAILED'\n" +
+ " test: " + "a.slice(" + x + "," + y + ")\n" +
+ " a: " + String(a) + "\n" +
+ " actual result: " + String(b) + "\n" +
+ " expected result: " + String(c) + "\n";
+ writeHeaderToLog(errorMessage);
+ reason = reason + errorMessage;
+ passed = false;
+ }
+ }
+ var testCase = new TestCase(SECTION, testname, true, passed);
+ if (passed == false)
+ testCase.reason = reason;
+ return testCase;
+ }
+
+ var a = new String("abcdefghijklmnopqrstuvwxyz1234567890");
+ var b = new String("this is a test string");
+
+ testcases[count++] = exhaustiveStringSliceTest("exhaustive String.slice test 1", a);
+ testcases[count++] = exhaustiveStringSliceTest("exhaustive String.slice test 2", b);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/JavaScriptCore/tests/mozilla/js1_2/browser.js b/JavaScriptCore/tests/mozilla/js1_2/browser.js
new file mode 100644
index 0000000..8b298a0
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/browser.js
@@ -0,0 +1,83 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/*
+ * JavaScript test library shared functions file for running the tests
+ * in the browser. Overrides the shell's print function with document.write
+ * and make everything HTML pretty.
+ *
+ * To run the tests in the browser, use the mkhtml.pl script to generate
+ * html pages that include the shell.js, browser.js (this file), and the
+ * test js file in script tags.
+ *
+ * The source of the page that is generated should look something like this:
+ * <script src="./../shell.js"></script>
+ * <script src="./../browser.js"></script>
+ * <script src="./mytest.js"></script>
+ */
+
+onerror = err;
+
+var GLOBAL = "[object Window]";
+
+function startTest() {
+ writeHeaderToLog( SECTION + " "+ TITLE);
+ if ( BUGNUMBER ) {
+ writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ }
+
+ testcases = new Array();
+ tc = 0;
+}
+
+function writeLineToLog( string ) {
+ document.write( string + "<br>\n");
+}
+function writeHeaderToLog( string ) {
+ document.write( "<h2>" + string + "</h2>" );
+}
+function stopTest() {
+ var gc;
+ if ( gc != undefined ) {
+ gc();
+ }
+ document.write( "<hr>" );
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = "<tt>"+ string ;
+ s += "<b>" ;
+ s += ( passed ) ? "<font color=#009900> &nbsp;" + PASSED
+ : "<font color=#aa0000>&nbsp;" + FAILED + expect + "</tt>";
+ writeLineToLog( s + "</font></b></tt>" );
+ return passed;
+}
+function err ( msg, page, line ) {
+ writeLineToLog( "Test " + page + " failed on line " + line +" with the message: " + msg );
+
+ testcases[tc].actual = "error";
+ testcases[tc].reason = msg;
+ writeTestCaseResult( testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual +
+ ": " + testcases[tc].reason );
+ stopTest();
+ return true;
+}
diff --git a/JavaScriptCore/tests/mozilla/js1_2/function/Function_object.js b/JavaScriptCore/tests/mozilla/js1_2/function/Function_object.js
new file mode 100644
index 0000000..1dec16a
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/function/Function_object.js
@@ -0,0 +1,85 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: Function_object.js
+ Description: 'Testing Function objects'
+
+ Author: Nick Lerissa
+ Date: April 17, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'functions: Function_object';
+
+ writeHeaderToLog('Executing script: Function_object.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ function a_test_function(a,b,c)
+ {
+ return a + b + c;
+ }
+
+ f = a_test_function;
+
+
+ testcases[count++] = new TestCase( SECTION, "f.name",
+ 'a_test_function', f.name);
+
+ testcases[count++] = new TestCase( SECTION, "f.length",
+ 3, f.length);
+
+ testcases[count++] = new TestCase( SECTION, "f.arity",
+ 3, f.arity);
+
+ testcases[count++] = new TestCase( SECTION, "f(2,3,4)",
+ 9, f(2,3,4));
+
+ var fnName = version() == 120 ? '' : 'anonymous';
+
+ testcases[count++] = new TestCase( SECTION, "(new Function()).name",
+ fnName, (new Function()).name);
+
+ testcases[count++] = new TestCase( SECTION, "(new Function()).toString()",
+ '\nfunction ' + fnName + '() {\n}\n', (new Function()).toString());
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/JavaScriptCore/tests/mozilla/js1_2/function/Number.js b/JavaScriptCore/tests/mozilla/js1_2/function/Number.js
new file mode 100644
index 0000000..9586f78
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/function/Number.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: Number.js
+ Description: 'This tests the function Number(Object)'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'functions: Number';
+ var BUGNUMBER="123435";
+
+ writeHeaderToLog('Executing script: Number.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ date = new Date(2200);
+
+ testcases[count++] = new TestCase( SECTION, "Number(new Date(2200)) ",
+ 2200, (Number(date)));
+ testcases[count++] = new TestCase( SECTION, "Number(true) ",
+ 1, (Number(true)));
+ testcases[count++] = new TestCase( SECTION, "Number(false) ",
+ 0, (Number(false)));
+ testcases[count++] = new TestCase( SECTION, "Number('124') ",
+ 124, (Number('124')));
+ testcases[count++] = new TestCase( SECTION, "Number('1.23') ",
+ 1.23, (Number('1.23')));
+ testcases[count++] = new TestCase( SECTION, "Number({p:1}) ",
+ NaN, (Number({p:1})));
+ testcases[count++] = new TestCase( SECTION, "Number(null) ",
+ 0, (Number(null)));
+ testcases[count++] = new TestCase( SECTION, "Number(-45) ",
+ -45, (Number(-45)));
+
+ // http://scopus.mcom.com/bugsplat/show_bug.cgi?id=123435
+ // under js1.2, Number([1,2,3]) should return 3.
+
+ /*
+ http://bugs.webkit.org/show_bug.cgi?id=11545#c4
+ According to ECMA 9.3, when input type was Object, should call
+ ToPrimitive(input arg, hint Number) first, and than ToNumber() later. However,
+ ToPrimitive() will use [[DefaultValue]](hint) rule when input Type was Object
+ (ECMA 8.6.2.6). So the input [1,2,3] will applied [[DefaultValue]](hint) rule
+ with hint Number, and it looks like this:
+
+ toString(valuOf([1,2,3])) => toString(1,2,3) => '1,2,3'
+
+ Than ToNumber('1,2,3') results NaN based on ECMA 9.3.1: If the grammar cannot
+ interpret the string as an expansion of StringNumericLiteral, then the result
+ of ToNumber is NaN.
+ */
+
+ //testcases[count++] = new TestCase( SECTION, "Number([1,2,3]) ",
+ // 3, (Number([1,2,3])));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/JavaScriptCore/tests/mozilla/js1_2/function/String.js b/JavaScriptCore/tests/mozilla/js1_2/function/String.js
new file mode 100644
index 0000000..724c392
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/function/String.js
@@ -0,0 +1,99 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: String.js
+ Description: 'This tests the function String(Object)'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'functions: String';
+
+ writeHeaderToLog('Executing script: String.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ testcases[count++] = new TestCase( SECTION, "String(true) ",
+ 'true', (String(true)));
+ testcases[count++] = new TestCase( SECTION, "String(false) ",
+ 'false', (String(false)));
+ testcases[count++] = new TestCase( SECTION, "String(-124) ",
+ '-124', (String(-124)));
+ testcases[count++] = new TestCase( SECTION, "String(1.23) ",
+ '1.23', (String(1.23)));
+ /*
+ http://bugs.webkit.org/show_bug.cgi?id=11545#c5
+ According to ECMA 9.8, when input type of String object argument was Object, we
+ should applied ToPrimitive(input arg, hint String) first, and later ToString().
+ And just like previous one, ToPrimitive() will use [[DefaultValue]](hint)
+ with hint String to convert the input (toString() below uses the rule in ECMA 15.2.4.2):
+
+ valueOf(toString({p:1}) => valueOf('[object Object]') => '[object Object]'
+
+ And ToString() called after ToPrimitive(), so the correct result would be:
+
+ [object Object]
+ */
+ //testcases[count++] = new TestCase( SECTION, "String({p:1}) ",
+ // '{p:1}', (String({p:1})));
+ testcases[count++] = new TestCase( SECTION, "String(null) ",
+ 'null', (String(null)));
+ /*
+ http://bugs.webkit.org/show_bug.cgi?id=11545#c5
+ According to ECMA 9.8, when input type of String object argument was Object, we
+ should applied ToPrimitive(input arg, hint String) first, and later ToString().
+ And just like previous one, ToPrimitive() will use [[DefaultValue]](hint)
+ with hint String to convert the input (toString() below uses the rule in ECMA 15.2.4.2):
+
+ valueOf(toString([1,2,3])) => valueOf('1,2,3') => '1,2,3'
+
+ And ToString() called after ToPrimitive(), so the correct result would be:
+
+ 1,2,3
+ */
+ //testcases[count++] = new TestCase( SECTION, "String([1,2,3]) ",
+ // '[1, 2, 3]', (String([1,2,3])));
+
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/JavaScriptCore/tests/mozilla/js1_2/function/definition-1.js b/JavaScriptCore/tests/mozilla/js1_2/function/definition-1.js
new file mode 100644
index 0000000..6daea71
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/function/definition-1.js
@@ -0,0 +1,73 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: definition-1.js
+ Reference: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=111284
+ Description: Regression test for declaring functions.
+
+ Author: christine@netscape.com
+ Date: 15 June 1998
+*/
+
+ var SECTION = "function/definition-1.js";
+ var VERSION = "JS_12";
+ startTest();
+ var TITLE = "Regression test for 111284";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ f1 = function() { return "passed!" }
+
+ function f2() { f3 = function() { return "passed!" }; return f3(); }
+
+ testcases[tc++] = new TestCase( SECTION,
+ 'f1 = function() { return "passed!" }; f1()',
+ "passed!",
+ f1() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ 'function f2() { f3 = function { return "passed!" }; return f3() }; f2()',
+ "passed!",
+ f2() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ 'f3()',
+ "passed!",
+ f3() );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/js1_2/function/function-001-n.js b/JavaScriptCore/tests/mozilla/js1_2/function/function-001-n.js
new file mode 100644
index 0000000..5ae01a9
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/function/function-001-n.js
@@ -0,0 +1,74 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ * File Name: boolean-001.js
+ * Description:
+ *
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232
+ *
+ * eval("function f(){}function g(){}") at top level is an error for JS1.2
+ * and above (missing ; between named function expressions), but declares f
+ * and g as functions below 1.2.
+ *
+ * Fails to produce error regardless of version:
+ * js> version(100)
+ * 120
+ * js> eval("function f(){}function g(){}")
+ * js> version(120);
+ * 100
+ * js> eval("function f(){}function g(){}")
+ * js>
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "function-001.js";
+ var VERSION = "JS1_1";
+ startTest();
+ var TITLE = "functions not separated by semicolons are errors in version 120 and higher";
+ var BUGNUMBER="99232";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "eval(\"function f(){}function g(){}\")",
+ "error",
+ eval("function f(){}function g(){}") );
+
+ test();
+
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/js1_2/function/length.js b/JavaScriptCore/tests/mozilla/js1_2/function/length.js
new file mode 100644
index 0000000..aae30d5
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/function/length.js
@@ -0,0 +1,93 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.3.5.1.js
+ ECMA Section: Function.length
+ Description:
+
+ The value of the length property is usually an integer that indicates the
+ "typical" number of arguments expected by the function. However, the
+ language permits the function to be invoked with some other number of
+ arguments. The behavior of a function when invoked on a number of arguments
+ other than the number specified by its length property depends on the function.
+
+ This checks the pre-ecma behavior Function.length.
+
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104204
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "function/length.js";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Function.length";
+ var BUGNUMBER="104204";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var f = new Function( "a","b", "c", "return f.length");
+
+ if ( version() <= 120 ) {
+
+ testcases[tc++] = new TestCase( SECTION,
+ 'var f = new Function( "a","b", "c", "return f.length"); f()',
+ 0,
+ f() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ 'var f = new Function( "a","b", "c", "return f.length"); f(1,2,3,4,5)',
+ 5,
+ f(1,2,3,4,5) );
+ } else {
+
+ testcases[tc++] = new TestCase( SECTION,
+ 'var f = new Function( "a","b", "c", "return f.length"); f()',
+ 3,
+ f() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ 'var f = new Function( "a","b", "c", "return f.length"); f(1,2,3,4,5)',
+ 3,
+ f(1,2,3,4,5) );
+
+
+ }
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/js1_2/function/nesting-1.js b/JavaScriptCore/tests/mozilla/js1_2/function/nesting-1.js
new file mode 100644
index 0000000..391f926
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/function/nesting-1.js
@@ -0,0 +1,61 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: nesting-1.js
+ Reference: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=122040
+ Description: Regression test for a nested function
+
+ Author: christine@netscape.com
+ Date: 15 June 1998
+*/
+
+ var SECTION = "function/nesting-1.js";
+ var VERSION = "JS_12";
+ startTest();
+ var TITLE = "Regression test for 122040";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ function f(a) {function g(b) {return a+b;}; return g;}; f(7)
+
+ testcases[tc++] = new TestCase( SECTION,
+ 'function f(a) {function g(b) {return a+b;}; return g;}; typeof f(7)',
+ "function",
+ typeof f(7) );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/js1_2/function/nesting.js b/JavaScriptCore/tests/mozilla/js1_2/function/nesting.js
new file mode 100644
index 0000000..b626da5
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/function/nesting.js
@@ -0,0 +1,83 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: nesting.js
+ Description: 'This tests the nesting of functions'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'functions: nesting';
+
+ writeHeaderToLog('Executing script: nesting.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ function outer_func(x)
+ {
+ var y = "outer";
+
+ testcases[count++] = new TestCase( SECTION, "outer:x ",
+ 1111, x);
+ testcases[count++] = new TestCase( SECTION, "outer:y ",
+ 'outer', y);
+ function inner_func(x)
+ {
+ var y = "inner";
+ testcases[count++] = new TestCase( SECTION, "inner:x ",
+ 2222, x);
+ testcases[count++] = new TestCase( SECTION, "inner:y ",
+ 'inner', y);
+ };
+
+ inner_func(2222);
+ testcases[count++] = new TestCase( SECTION, "outer:x ",
+ 1111, x);
+ testcases[count++] = new TestCase( SECTION, "outer:y ",
+ 'outer', y);
+ }
+
+ outer_func(1111);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/JavaScriptCore/tests/mozilla/js1_2/function/regexparg-1.js b/JavaScriptCore/tests/mozilla/js1_2/function/regexparg-1.js
new file mode 100644
index 0000000..b01825c
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/function/regexparg-1.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: regexparg-1.js
+ Description:
+
+ Regression test for
+ http://scopus/bugsplat/show_bug.cgi?id=122787
+ Passing a regular expression as the first constructor argument fails
+
+ Author: christine@netscape.com
+ Date: 15 June 1998
+*/
+
+ var SECTION = "JS_1.2";
+ var VERSION = "JS_1.2";
+ startTest();
+ var TITLE = "The variable statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ function f(x) {return x;}
+
+ x = f(/abc/);
+
+ testcases[tc++] = new TestCase( SECTION,
+ "function f(x) {return x;}; f()",
+ void 0,
+ f() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "f(\"hi\")",
+ "hi",
+ f("hi") );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "new f(/abc/) +''",
+ "/abc/",
+ new f(/abc/) +"" );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "f(/abc/)+'')",
+ "/abc/",
+ f(/abc/) +'');
+
+ testcases[tc++] = new TestCase( SECTION,
+ "typeof f(/abc/)",
+ "function",
+ typeof f(/abc/) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "typeof new f(/abc/)",
+ "function",
+ typeof new f(/abc/) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "x = new f(/abc/); x(\"hi\")",
+ null,
+ x("hi") );
+
+
+ // js> x()
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/js1_2/function/regexparg-2-n.js b/JavaScriptCore/tests/mozilla/js1_2/function/regexparg-2-n.js
new file mode 100644
index 0000000..e8bf951
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/function/regexparg-2-n.js
@@ -0,0 +1,66 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: regexparg-1.js
+ Description:
+
+ Regression test for
+ http://scopus/bugsplat/show_bug.cgi?id=122787
+ Passing a regular expression as the first constructor argument fails
+
+ Author: christine@netscape.com
+ Date: 15 June 1998
+*/
+
+ var SECTION = "JS_1.2";
+ var VERSION = "JS_1.2";
+ startTest();
+ var TITLE = "The variable statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ function f(x) {return x;}
+
+ x = f(/abc/);
+
+ testcases[tc++] = new TestCase( SECTION,
+ "function f(x) {return x;}; x = f(/abc/); x()",
+ "error",
+ x() );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/js1_2/function/tostring-1.js b/JavaScriptCore/tests/mozilla/js1_2/function/tostring-1.js
new file mode 100644
index 0000000..d532d65
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/function/tostring-1.js
@@ -0,0 +1,143 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: tostring-1.js
+ Section: Function.toString
+ Description:
+
+ Since the behavior of Function.toString() is implementation-dependent,
+ toString tests for function are not in the ECMA suite.
+
+ Currently, an attempt to parse the toString output for some functions
+ and verify that the result is something reasonable.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "tostring-1";
+ var VERSION = "JS1_2";
+ startTest();
+ var TITLE = "Function.toString()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var tab = " ";
+
+ t1 = new TestFunction( "stub", "value", tab + "return value;" );
+
+ t2 = new TestFunction( "ToString", "object", tab+"return object + \"\";" );
+
+ t3 = new TestFunction( "Add", "a, b, c, d, e", tab +"var s = a + b + c + d + e;\n" +
+ tab + "return s;" );
+
+ t4 = new TestFunction( "noop", "value" );
+
+ t5 = new TestFunction( "anonymous", "", tab+"return \"hello!\";" );
+
+ var f = new Function( "return \"hello!\"");
+
+ testcases[tc++] = new TestCase( SECTION,
+ "stub.toString()",
+ t1.valueOf(),
+ stub.toString() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "ToString.toString()",
+ t2.valueOf(),
+ ToString.toString() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Add.toString()",
+ t3.valueOf(),
+ Add.toString() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "noop.toString()",
+ t4.toString(),
+ noop.toString() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "f.toString()",
+ t5.toString(),
+ f.toString() );
+ test();
+
+function noop( value ) {
+}
+function Add( a, b, c, d, e ) {
+ var s = a + b + c + d + e;
+ return s;
+}
+function stub( value ) {
+ return value;
+}
+function ToString( object ) {
+ return object + "";
+}
+
+function ToBoolean( value ) {
+ if ( value == 0 || value == NaN || value == false ) {
+ return false;
+ } else {
+ return true;
+ }
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function TestFunction( name, args, body ) {
+ if ( name == "anonymous" && version() == 120 ) {
+ name = "";
+ }
+
+ this.name = name;
+ this.arguments = args.toString();
+ this.body = body;
+
+ /* the format of Function.toString() in JavaScript 1.2 is:
+ /n
+ function name ( arguments ) {
+ body
+ }
+ */
+ this.value = "\nfunction " + (name ? name : "" )+
+ "("+args+") {\n"+ (( body ) ? body +"\n" : "") + "}\n";
+
+ this.toString = new Function( "return this.value" );
+ this.valueOf = new Function( "return this.value" );
+ return this;
+}
diff --git a/JavaScriptCore/tests/mozilla/js1_2/function/tostring-2.js b/JavaScriptCore/tests/mozilla/js1_2/function/tostring-2.js
new file mode 100644
index 0000000..146764d
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/function/tostring-2.js
@@ -0,0 +1,185 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: tostring-1.js
+ Section: Function.toString
+ Description:
+
+ Since the behavior of Function.toString() is implementation-dependent,
+ toString tests for function are not in the ECMA suite.
+
+ Currently, an attempt to parse the toString output for some functions
+ and verify that the result is something reasonable.
+
+ This verifies
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99212
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "tostring-2";
+ var VERSION = "JS1_2";
+ startTest();
+ var TITLE = "Function.toString()";
+ var BUGNUMBER="123444";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var tab = " ";
+
+
+var equals = new TestFunction( "Equals", "a, b", tab+ "return a == b;" );
+function Equals (a, b) {
+ return a == b;
+}
+
+var reallyequals = new TestFunction( "ReallyEquals", "a, b",
+ ( version() <= 120 ) ? tab +"return a == b;" : tab +"return a === b;" );
+function ReallyEquals( a, b ) {
+ return a === b;
+}
+
+var doesntequal = new TestFunction( "DoesntEqual", "a, b", tab + "return a != b;" );
+function DoesntEqual( a, b ) {
+ return a != b;
+}
+
+var reallydoesntequal = new TestFunction( "ReallyDoesntEqual", "a, b",
+ ( version() <= 120 ) ? tab +"return a != b;" : tab +"return a !== b;" );
+function ReallyDoesntEqual( a, b ) {
+ return a !== b;
+}
+
+var testor = new TestFunction( "TestOr", "a", tab+"if (a == null || a == void 0) {\n"+
+ tab +tab+"return 0;\n"+tab+"} else {\n"+tab+tab+"return a;\n"+tab+"}" );
+function TestOr( a ) {
+ if ( a == null || a == void 0 )
+ return 0;
+ else
+ return a;
+}
+
+var testand = new TestFunction( "TestAnd", "a", tab+"if (a != null && a != void 0) {\n"+
+ tab+tab+"return a;\n" + tab+ "} else {\n"+tab+tab+"return 0;\n"+tab+"}" );
+function TestAnd( a ) {
+ if ( a != null && a != void 0 )
+ return a;
+ else
+ return 0;
+}
+
+var or = new TestFunction( "Or", "a, b", tab + "return a | b;" );
+function Or( a, b ) {
+ return a | b;
+}
+
+var and = new TestFunction( "And", "a, b", tab + "return a & b;" );
+function And( a, b ) {
+ return a & b;
+}
+
+var xor = new TestFunction( "XOr", "a, b", tab + "return a ^ b;" );
+function XOr( a, b ) {
+ return a ^ b;
+}
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "Equals.toString()",
+ equals.valueOf(),
+ Equals.toString() );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "ReallyEquals.toString()",
+ reallyequals.valueOf(),
+ ReallyEquals.toString() );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "DoesntEqual.toString()",
+ doesntequal.valueOf(),
+ DoesntEqual.toString() );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "ReallyDoesntEqual.toString()",
+ reallydoesntequal.valueOf(),
+ ReallyDoesntEqual.toString() );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "TestOr.toString()",
+ testor.valueOf(),
+ TestOr.toString() );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "TestAnd.toString()",
+ testand.valueOf(),
+ TestAnd.toString() );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "Or.toString()",
+ or.valueOf(),
+ Or.toString() );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "And.toString()",
+ and.valueOf(),
+ And.toString() );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "XOr.toString()",
+ xor.valueOf(),
+ XOr.toString() );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function TestFunction( name, args, body ) {
+ this.name = name;
+ this.arguments = args.toString();
+ this.body = body;
+
+ /* the format of Function.toString() in JavaScript 1.2 is:
+ /n
+ function name ( arguments ) {
+ body
+ }
+ */
+ this.value = "\nfunction " + (name ? name : "anonymous" )+
+ "("+args+") {\n"+ (( body ) ? body +"\n" : "") + "}\n";
+
+ this.toString = new Function( "return this.value" );
+ this.valueOf = new Function( "return this.value" );
+ return this;
+}
diff --git a/JavaScriptCore/tests/mozilla/js1_2/jsref.js b/JavaScriptCore/tests/mozilla/js1_2/jsref.js
new file mode 100644
index 0000000..3ecb4c1
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/jsref.js
@@ -0,0 +1,215 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+var completed = false;
+var testcases;
+var tc = 0;
+
+SECTION = "";
+VERSION = "";
+BUGNUMBER = "";
+EXCLUDE = "";
+
+/*
+ * constant strings
+ */
+var GLOBAL = "[object global]";
+var PASSED = " PASSED!"
+var FAILED = " FAILED! expected: ";
+
+var DEBUG = false;
+
+version("120");
+/*
+ * change this for date tests if you're not in PST
+ */
+
+TZ_DIFF = -8;
+/* wrapper for test cas constructor that doesn't require the SECTION
+ * argument.
+ */
+
+function AddTestCase( description, expect, actual ) {
+ testcases[tc++] = new TestCase( SECTION, description, expect, actual );
+}
+function TestCase( n, d, e, a ) {
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+ this.bugnumber = BUGNUMBER;
+
+ this.passed = getTestCaseResult( this.expect, this.actual );
+}
+function startTest() {
+ version(120);
+
+ // for ecma version 2.0, we will leave the javascript version to
+ // the default ( for now ).
+ // print out bugnumber
+
+ if ( BUGNUMBER ) {
+ writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ }
+
+ testcases = new Array();
+ tc = 0;
+
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCaseResult( expect, actual ) {
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual ) {
+ if ( typeof actual == "object" ) {
+ actual = "NaN object";
+ } else {
+ actual = "NaN number";
+ }
+ }
+ if ( expect != expect ) {
+ if ( typeof expect == "object" ) {
+ expect = "NaN object";
+ } else {
+ expect = "NaN number";
+ }
+ }
+
+ var passed = ( expect == actual ) ? true : false;
+
+ // if both objects are numbers, give a little leeway for rounding.
+ if ( !passed
+ && typeof(actual) == "number"
+ && typeof(expect) == "number"
+ ) {
+ if ( Math.abs(actual-expect) < 0.0000001 ) {
+ passed = true;
+ }
+ }
+
+ // verify type is the same
+ if ( typeof(expect) != typeof(actual) ) {
+ passed = false;
+ }
+
+ return passed;
+}
+/*
+ * Begin printing functions. These functions use the shell's
+ * print function. When running tests in the browser, these
+ * functions, override these functions with functions that use
+ * document.write.
+ */
+
+function writeTestCaseResult( expect, actual, string ) {
+ var passed = getTestCaseResult( expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = string ;
+ s += ( passed ) ? PASSED : FAILED + expect;
+ writeLineToLog( s);
+ return passed;
+}
+function writeLineToLog( string ) {
+ print( string );
+}
+function writeHeaderToLog( string ) {
+ print( string );
+}
+/* end of print functions */
+
+
+function stopTest() {
+ var sizeTag = "<#TEST CASES SIZE>";
+ var doneTag = "<#TEST CASES DONE>";
+ var beginTag = "<#TEST CASE ";
+ var endTag = ">";
+
+ print(sizeTag);
+ print(testcases.length);
+ for (tc = 0; tc < testcases.length; tc++)
+ {
+ print(beginTag + 'PASSED' + endTag);
+ print(testcases[tc].passed);
+ print(beginTag + 'NAME' + endTag);
+ print(testcases[tc].name);
+ print(beginTag + 'EXPECTED' + endTag);
+ print(testcases[tc].expect);
+ print(beginTag + 'ACTUAL' + endTag);
+ print(testcases[tc].actual);
+ print(beginTag + 'DESCRIPTION' + endTag);
+ print(testcases[tc].description);
+ print(beginTag + 'REASON' + endTag);
+ print(( testcases[tc].passed ) ? "" : "wrong value ");
+ print(beginTag + 'BUGNUMBER' + endTag);
+ print( BUGNUMBER );
+ }
+ print(doneTag);
+ gc();
+}
+
+function getFailedCases() {
+ for ( var i = 0; i < testcases.length; i++ ) {
+ if ( ! testcases[i].passed ) {
+ print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
+ }
+ }
+}
+function err( msg, page, line ) {
+ testcases[tc].actual = "error";
+ testcases[tc].reason = msg;
+ writeTestCaseResult( testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual +
+ ": " + testcases[tc].reason );
+ stopTest();
+ return true;
+}
+function Enumerate ( o ) {
+ var p;
+ for ( p in o ) {
+ print( p +": " + o[p] );
+ }
+}
+function GetContext() {
+ return Packages.com.netscape.javascript.Context.getCurrentContext();
+}
+function OptLevel( i ) {
+ i = Number(i);
+ var cx = GetContext();
+ cx.setOptimizationLevel(i);
+}
diff --git a/JavaScriptCore/tests/mozilla/js1_2/operator/equality.js b/JavaScriptCore/tests/mozilla/js1_2/operator/equality.js
new file mode 100644
index 0000000..855b5a8
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/operator/equality.js
@@ -0,0 +1,72 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: equality.js
+ Description: 'This tests the operator =='
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'operator "=="';
+
+ writeHeaderToLog('Executing script: equality.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ // the following two tests are incorrect
+ //testcases[count++] = new TestCase( SECTION, "(new String('') == new String('')) ",
+ // true, (new String('') == new String('')));
+
+ //testcases[count++] = new TestCase( SECTION, "(new Boolean(true) == new Boolean(true)) ",
+ // true, (new Boolean(true) == new Boolean(true)));
+
+ testcases[count++] = new TestCase( SECTION, "(new String('x') == 'x') ",
+ false, (new String('x') == 'x'));
+
+ testcases[count++] = new TestCase( SECTION, "('x' == new String('x')) ",
+ false, ('x' == new String('x')));
+
+
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/JavaScriptCore/tests/mozilla/js1_2/operator/strictEquality.js b/JavaScriptCore/tests/mozilla/js1_2/operator/strictEquality.js
new file mode 100644
index 0000000..0f8acea
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/operator/strictEquality.js
@@ -0,0 +1,92 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: strictEquality.js
+ Description: 'This tests the operator ==='
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'operator "==="';
+
+ writeHeaderToLog('Executing script: strictEquality.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ testcases[count++] = new TestCase( SECTION, "('8' === 8) ",
+ false, ('8' === 8));
+
+ testcases[count++] = new TestCase( SECTION, "(8 === 8) ",
+ true, (8 === 8));
+
+ testcases[count++] = new TestCase( SECTION, "(8 === true) ",
+ false, (8 === true));
+
+ testcases[count++] = new TestCase( SECTION, "(new String('') === new String('')) ",
+ false, (new String('') === new String('')));
+
+ testcases[count++] = new TestCase( SECTION, "(new Boolean(true) === new Boolean(true))",
+ false, (new Boolean(true) === new Boolean(true)));
+
+ var anObject = { one:1 , two:2 };
+
+ testcases[count++] = new TestCase( SECTION, "(anObject === anObject) ",
+ true, (anObject === anObject));
+
+ testcases[count++] = new TestCase( SECTION, "(anObject === { one:1 , two:2 }) ",
+ false, (anObject === { one:1 , two:2 }));
+
+ testcases[count++] = new TestCase( SECTION, "({ one:1 , two:2 } === anObject) ",
+ false, ({ one:1 , two:2 } === anObject));
+
+ testcases[count++] = new TestCase( SECTION, "(null === null) ",
+ true, (null === null));
+
+ testcases[count++] = new TestCase( SECTION, "(null === 0) ",
+ false, (null === 0));
+
+ testcases[count++] = new TestCase( SECTION, "(true === !false) ",
+ true, (true === !false));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_dollar_number.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_dollar_number.js
new file mode 100644
index 0000000..58f9264
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_dollar_number.js
@@ -0,0 +1,108 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_dollar_number.js
+ Description: 'Tests RegExps $1, ..., $9 properties'
+
+ Author: Nick Lerissa
+ Date: March 12, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: $1, ..., $9';
+ var BUGNUMBER="123802";
+
+ writeHeaderToLog('Executing script: RegExp_dollar_number.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$1
+ 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$1",
+ 'abcdefghi', RegExp.$1);
+
+ // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$2
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$2",
+ 'bcdefgh', RegExp.$2);
+
+ // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$3
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$3",
+ 'cdefg', RegExp.$3);
+
+ // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$4
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$4",
+ 'def', RegExp.$4);
+
+ // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$5
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$5",
+ 'e', RegExp.$5);
+
+ // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$6
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$6",
+ '', RegExp.$6);
+
+ var a_to_z = 'abcdefghijklmnopqrstuvwxyz';
+ var regexp1 = /(a)b(c)d(e)f(g)h(i)j(k)l(m)n(o)p(q)r(s)t(u)v(w)x(y)z/
+ // 'abcdefghijklmnopqrstuvwxyz'.match(/(a)b(c)d(e)f(g)h(i)j(k)l(m)n(o)p(q)r(s)t(u)v(w)x(y)z/); RegExp.$1
+ a_to_z.match(regexp1);
+
+ testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$1",
+ 'a', RegExp.$1);
+ testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$2",
+ 'c', RegExp.$2);
+ testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$3",
+ 'e', RegExp.$3);
+ testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$4",
+ 'g', RegExp.$4);
+ testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$5",
+ 'i', RegExp.$5);
+ testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$6",
+ 'k', RegExp.$6);
+ testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$7",
+ 'm', RegExp.$7);
+ testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$8",
+ 'o', RegExp.$8);
+ testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$9",
+ 'q', RegExp.$9);
+/*
+ testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$10",
+ 's', RegExp.$10);
+*/
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input.js
new file mode 100644
index 0000000..01c145c
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input.js
@@ -0,0 +1,102 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_input.js
+ Description: 'Tests RegExps input property'
+
+ Author: Nick Lerissa
+ Date: March 13, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: input';
+
+ writeHeaderToLog('Executing script: RegExp_input.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ RegExp.input = "abcd12357efg";
+
+ // RegExp.input = "abcd12357efg"; RegExp.input
+ RegExp.input = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; RegExp.input",
+ "abcd12357efg", RegExp.input);
+
+ // RegExp.input = "abcd12357efg"; /\d+/.exec('2345')
+ RegExp.input = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.exec('2345')",
+ String(["2345"]), String(/\d+/.exec('2345')));
+
+ // RegExp.input = "abcd12357efg"; /\d+/.exec()
+ RegExp.input = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.exec()",
+ String(["12357"]), String(/\d+/.exec()));
+
+ // RegExp.input = "abcd12357efg"; /[h-z]+/.exec()
+ RegExp.input = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /[h-z]+/.exec()",
+ null, /[h-z]+/.exec());
+
+ // RegExp.input = "abcd12357efg"; /\d+/.test('2345')
+ RegExp.input = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.test('2345')",
+ true, /\d+/.test('2345'));
+
+ // RegExp.input = "abcd12357efg"; /\d+/.test()
+ RegExp.input = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.test()",
+ true, /\d+/.test());
+
+ // RegExp.input = "abcd12357efg"; (new RegExp('d+')).test()
+ RegExp.input = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; (new RegExp('d+')).test()",
+ true, (new RegExp('d+')).test());
+
+ // RegExp.input = "abcd12357efg"; /[h-z]+/.test()
+ RegExp.input = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /[h-z]+/.test()",
+ false, /[h-z]+/.test());
+
+ // RegExp.input = "abcd12357efg"; (new RegExp('[h-z]+')).test()
+ RegExp.input = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; (new RegExp('[h-z]+')).test()",
+ false, (new RegExp('[h-z]+')).test());
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input_as_array.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input_as_array.js
new file mode 100644
index 0000000..a1ed113
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input_as_array.js
@@ -0,0 +1,102 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_input_as_array.js
+ Description: 'Tests RegExps $_ property (same tests as RegExp_input.js but using $_)'
+
+ Author: Nick Lerissa
+ Date: March 13, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: input';
+
+ writeHeaderToLog('Executing script: RegExp_input.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ RegExp['$_'] = "abcd12357efg";
+
+ // RegExp['$_'] = "abcd12357efg"; RegExp['$_']
+ RegExp['$_'] = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; RegExp['$_']",
+ "abcd12357efg", RegExp['$_']);
+
+ // RegExp['$_'] = "abcd12357efg"; /\d+/.exec('2345')
+ RegExp['$_'] = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.exec('2345')",
+ String(["2345"]), String(/\d+/.exec('2345')));
+
+ // RegExp['$_'] = "abcd12357efg"; /\d+/.exec()
+ RegExp['$_'] = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.exec()",
+ String(["12357"]), String(/\d+/.exec()));
+
+ // RegExp['$_'] = "abcd12357efg"; /[h-z]+/.exec()
+ RegExp['$_'] = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /[h-z]+/.exec()",
+ null, /[h-z]+/.exec());
+
+ // RegExp['$_'] = "abcd12357efg"; /\d+/.test('2345')
+ RegExp['$_'] = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.test('2345')",
+ true, /\d+/.test('2345'));
+
+ // RegExp['$_'] = "abcd12357efg"; /\d+/.test()
+ RegExp['$_'] = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.test()",
+ true, /\d+/.test());
+
+ // RegExp['$_'] = "abcd12357efg"; /[h-z]+/.test()
+ RegExp['$_'] = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /[h-z]+/.test()",
+ false, /[h-z]+/.test());
+
+ // RegExp['$_'] = "abcd12357efg"; (new RegExp('\d+')).test()
+ RegExp['$_'] = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; (new RegExp('\d+')).test()",
+ true, (new RegExp('\d+')).test());
+
+ // RegExp['$_'] = "abcd12357efg"; (new RegExp('[h-z]+')).test()
+ RegExp['$_'] = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; (new RegExp('[h-z]+')).test()",
+ false, (new RegExp('[h-z]+')).test());
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastIndex.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastIndex.js
new file mode 100644
index 0000000..b48836f
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastIndex.js
@@ -0,0 +1,83 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_lastIndex.js
+ Description: 'Tests RegExps lastIndex property'
+
+ Author: Nick Lerissa
+ Date: March 17, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: lastIndex';
+ var BUGNUMBER="123802";
+
+ writeHeaderToLog('Executing script: RegExp_lastIndex.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // re=/x./g; re.lastIndex=4; re.exec('xyabcdxa');
+ re=/x./g;
+ re.lastIndex=4;
+ testcases[count++] = new TestCase ( SECTION, "re=/x./g; re.lastIndex=4; re.exec('xyabcdxa')",
+ '["xa"]', String(re.exec('xyabcdxa')));
+
+ // re.lastIndex
+ testcases[count++] = new TestCase ( SECTION, "re.lastIndex",
+ 8, re.lastIndex);
+
+ // re.exec('xyabcdef');
+ testcases[count++] = new TestCase ( SECTION, "re.exec('xyabcdef')",
+ null, re.exec('xyabcdef'));
+
+ // re.lastIndex
+ testcases[count++] = new TestCase ( SECTION, "re.lastIndex",
+ 0, re.lastIndex);
+
+ // re.exec('xyabcdef');
+ testcases[count++] = new TestCase ( SECTION, "re.exec('xyabcdef')",
+ '["xy"]', String(re.exec('xyabcdef')));
+
+ // re.lastIndex=30; re.exec('123xaxbxc456');
+ re.lastIndex=30;
+ testcases[count++] = new TestCase ( SECTION, "re.lastIndex=30; re.exec('123xaxbxc456')",
+ null, re.exec('123xaxbxc456'));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch.js
new file mode 100644
index 0000000..2b0c72d
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch.js
@@ -0,0 +1,85 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_lastMatch.js
+ Description: 'Tests RegExps lastMatch property'
+
+ Author: Nick Lerissa
+ Date: March 12, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: lastMatch';
+
+ writeHeaderToLog('Executing script: RegExp_lastMatch.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'foo'.match(/foo/); RegExp.lastMatch
+ 'foo'.match(/foo/);
+ testcases[count++] = new TestCase ( SECTION, "'foo'.match(/foo/); RegExp.lastMatch",
+ 'foo', RegExp.lastMatch);
+
+ // 'foo'.match(new RegExp('foo')); RegExp.lastMatch
+ 'foo'.match(new RegExp('foo'));
+ testcases[count++] = new TestCase ( SECTION, "'foo'.match(new RegExp('foo')); RegExp.lastMatch",
+ 'foo', RegExp.lastMatch);
+
+ // 'xxx'.match(/bar/); RegExp.lastMatch
+ 'xxx'.match(/bar/);
+ testcases[count++] = new TestCase ( SECTION, "'xxx'.match(/bar/); RegExp.lastMatch",
+ 'foo', RegExp.lastMatch);
+
+ // 'xxx'.match(/$/); RegExp.lastMatch
+ 'xxx'.match(/$/);
+ testcases[count++] = new TestCase ( SECTION, "'xxx'.match(/$/); RegExp.lastMatch",
+ '', RegExp.lastMatch);
+
+ // 'abcdefg'.match(/^..(cd)[a-z]+/); RegExp.lastMatch
+ 'abcdefg'.match(/^..(cd)[a-z]+/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/^..(cd)[a-z]+/); RegExp.lastMatch",
+ 'abcdefg', RegExp.lastMatch);
+
+ // 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/); RegExp.lastMatch
+ 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\\1/); RegExp.lastMatch",
+ 'abcdefgabcdefg', RegExp.lastMatch);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch_as_array.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch_as_array.js
new file mode 100644
index 0000000..b59b2c2
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch_as_array.js
@@ -0,0 +1,85 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_lastMatch_as_array.js
+ Description: 'Tests RegExps $& property (same tests as RegExp_lastMatch.js but using $&)'
+
+ Author: Nick Lerissa
+ Date: March 13, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: $&';
+
+ writeHeaderToLog('Executing script: RegExp_lastMatch_as_array.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'foo'.match(/foo/); RegExp['$&']
+ 'foo'.match(/foo/);
+ testcases[count++] = new TestCase ( SECTION, "'foo'.match(/foo/); RegExp['$&']",
+ 'foo', RegExp['$&']);
+
+ // 'foo'.match(new RegExp('foo')); RegExp['$&']
+ 'foo'.match(new RegExp('foo'));
+ testcases[count++] = new TestCase ( SECTION, "'foo'.match(new RegExp('foo')); RegExp['$&']",
+ 'foo', RegExp['$&']);
+
+ // 'xxx'.match(/bar/); RegExp['$&']
+ 'xxx'.match(/bar/);
+ testcases[count++] = new TestCase ( SECTION, "'xxx'.match(/bar/); RegExp['$&']",
+ 'foo', RegExp['$&']);
+
+ // 'xxx'.match(/$/); RegExp['$&']
+ 'xxx'.match(/$/);
+ testcases[count++] = new TestCase ( SECTION, "'xxx'.match(/$/); RegExp['$&']",
+ '', RegExp['$&']);
+
+ // 'abcdefg'.match(/^..(cd)[a-z]+/); RegExp['$&']
+ 'abcdefg'.match(/^..(cd)[a-z]+/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/^..(cd)[a-z]+/); RegExp['$&']",
+ 'abcdefg', RegExp['$&']);
+
+ // 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/); RegExp['$&']
+ 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\\1/); RegExp['$&']",
+ 'abcdefgabcdefg', RegExp['$&']);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen.js
new file mode 100644
index 0000000..1dd0791
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen.js
@@ -0,0 +1,100 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_lastParen.js
+ Description: 'Tests RegExps lastParen property'
+
+ Author: Nick Lerissa
+ Date: March 12, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: lastParen';
+
+ writeHeaderToLog('Executing script: RegExp_lastParen.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcd'.match(/(abc)d/); RegExp.lastParen
+ 'abcd'.match(/(abc)d/);
+ testcases[count++] = new TestCase ( SECTION, "'abcd'.match(/(abc)d/); RegExp.lastParen",
+ 'abc', RegExp.lastParen);
+
+ // 'abcd'.match(new RegExp('(abc)d')); RegExp.lastParen
+ 'abcd'.match(new RegExp('(abc)d'));
+ testcases[count++] = new TestCase ( SECTION, "'abcd'.match(new RegExp('(abc)d')); RegExp.lastParen",
+ 'abc', RegExp.lastParen);
+
+ // 'abcd'.match(/(bcd)e/); RegExp.lastParen
+ 'abcd'.match(/(bcd)e/);
+ testcases[count++] = new TestCase ( SECTION, "'abcd'.match(/(bcd)e/); RegExp.lastParen",
+ 'abc', RegExp.lastParen);
+
+ // 'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp.lastParen
+ 'abcdefg'.match(/(a(b(c(d)e)f)g)/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp.lastParen",
+ 'd', RegExp.lastParen);
+
+ // 'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp.lastParen
+ 'abcdefg'.match(/(a(b)c)(d(e)f)/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp.lastParen",
+ 'e', RegExp.lastParen);
+
+ // 'abcdefg'.match(/(^)abc/); RegExp.lastParen
+ 'abcdefg'.match(/(^)abc/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(^)abc/); RegExp.lastParen",
+ '', RegExp.lastParen);
+
+ // 'abcdefg'.match(/(^a)bc/); RegExp.lastParen
+ 'abcdefg'.match(/(^a)bc/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(^a)bc/); RegExp.lastParen",
+ 'a', RegExp.lastParen);
+
+ // 'abcdefg'.match(new RegExp('(^a)bc')); RegExp.lastParen
+ 'abcdefg'.match(new RegExp('(^a)bc'));
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(^a)bc')); RegExp.lastParen",
+ 'a', RegExp.lastParen);
+
+ // 'abcdefg'.match(/bc/); RegExp.lastParen
+ 'abcdefg'.match(/bc/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/bc/); RegExp.lastParen",
+ '', RegExp.lastParen);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen_as_array.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen_as_array.js
new file mode 100644
index 0000000..d8dcd52
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen_as_array.js
@@ -0,0 +1,100 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_lastParen_as_array.js
+ Description: 'Tests RegExps $+ property (same tests as RegExp_lastParen.js but using $+)'
+
+ Author: Nick Lerissa
+ Date: March 13, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: $+';
+
+ writeHeaderToLog('Executing script: RegExp_lastParen_as_array.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcd'.match(/(abc)d/); RegExp['$+']
+ 'abcd'.match(/(abc)d/);
+ testcases[count++] = new TestCase ( SECTION, "'abcd'.match(/(abc)d/); RegExp['$+']",
+ 'abc', RegExp['$+']);
+
+ // 'abcd'.match(/(bcd)e/); RegExp['$+']
+ 'abcd'.match(/(bcd)e/);
+ testcases[count++] = new TestCase ( SECTION, "'abcd'.match(/(bcd)e/); RegExp['$+']",
+ 'abc', RegExp['$+']);
+
+ // 'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp['$+']
+ 'abcdefg'.match(/(a(b(c(d)e)f)g)/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp['$+']",
+ 'd', RegExp['$+']);
+
+ // 'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)')); RegExp['$+']
+ 'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)'));
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)')); RegExp['$+']",
+ 'd', RegExp['$+']);
+
+ // 'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp['$+']
+ 'abcdefg'.match(/(a(b)c)(d(e)f)/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp['$+']",
+ 'e', RegExp['$+']);
+
+ // 'abcdefg'.match(/(^)abc/); RegExp['$+']
+ 'abcdefg'.match(/(^)abc/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(^)abc/); RegExp['$+']",
+ '', RegExp['$+']);
+
+ // 'abcdefg'.match(/(^a)bc/); RegExp['$+']
+ 'abcdefg'.match(/(^a)bc/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(^a)bc/); RegExp['$+']",
+ 'a', RegExp['$+']);
+
+ // 'abcdefg'.match(new RegExp('(^a)bc')); RegExp['$+']
+ 'abcdefg'.match(new RegExp('(^a)bc'));
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(^a)bc')); RegExp['$+']",
+ 'a', RegExp['$+']);
+
+ // 'abcdefg'.match(/bc/); RegExp['$+']
+ 'abcdefg'.match(/bc/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/bc/); RegExp['$+']",
+ '', RegExp['$+']);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext.js
new file mode 100644
index 0000000..025915a
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext.js
@@ -0,0 +1,90 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_leftContext.js
+ Description: 'Tests RegExps leftContext property'
+
+ Author: Nick Lerissa
+ Date: March 12, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: leftContext';
+
+ writeHeaderToLog('Executing script: RegExp_leftContext.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abc123xyz'.match(/123/); RegExp.leftContext
+ 'abc123xyz'.match(/123/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/123/); RegExp.leftContext",
+ 'abc', RegExp.leftContext);
+
+ // 'abc123xyz'.match(/456/); RegExp.leftContext
+ 'abc123xyz'.match(/456/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/456/); RegExp.leftContext",
+ 'abc', RegExp.leftContext);
+
+ // 'abc123xyz'.match(/abc123xyz/); RegExp.leftContext
+ 'abc123xyz'.match(/abc123xyz/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/abc123xyz/); RegExp.leftContext",
+ '', RegExp.leftContext);
+
+ // 'xxxx'.match(/$/); RegExp.leftContext
+ 'xxxx'.match(/$/);
+ testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(/$/); RegExp.leftContext",
+ 'xxxx', RegExp.leftContext);
+
+ // 'test'.match(/^/); RegExp.leftContext
+ 'test'.match(/^/);
+ testcases[count++] = new TestCase ( SECTION, "'test'.match(/^/); RegExp.leftContext",
+ '', RegExp.leftContext);
+
+ // 'xxxx'.match(new RegExp('$')); RegExp.leftContext
+ 'xxxx'.match(new RegExp('$'));
+ testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(new RegExp('$')); RegExp.leftContext",
+ 'xxxx', RegExp.leftContext);
+
+ // 'test'.match(new RegExp('^')); RegExp.leftContext
+ 'test'.match(new RegExp('^'));
+ testcases[count++] = new TestCase ( SECTION, "'test'.match(new RegExp('^')); RegExp.leftContext",
+ '', RegExp.leftContext);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext_as_array.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext_as_array.js
new file mode 100644
index 0000000..5a86b4f
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext_as_array.js
@@ -0,0 +1,90 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_leftContext_as_array.js
+ Description: 'Tests RegExps leftContext property (same tests as RegExp_leftContext.js but using $`)'
+
+ Author: Nick Lerissa
+ Date: March 12, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: $`';
+
+ writeHeaderToLog('Executing script: RegExp_leftContext_as_array.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abc123xyz'.match(/123/); RegExp['$`']
+ 'abc123xyz'.match(/123/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/123/); RegExp['$`']",
+ 'abc', RegExp['$`']);
+
+ // 'abc123xyz'.match(/456/); RegExp['$`']
+ 'abc123xyz'.match(/456/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/456/); RegExp['$`']",
+ 'abc', RegExp['$`']);
+
+ // 'abc123xyz'.match(/abc123xyz/); RegExp['$`']
+ 'abc123xyz'.match(/abc123xyz/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/abc123xyz/); RegExp['$`']",
+ '', RegExp['$`']);
+
+ // 'xxxx'.match(/$/); RegExp['$`']
+ 'xxxx'.match(/$/);
+ testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(/$/); RegExp['$`']",
+ 'xxxx', RegExp['$`']);
+
+ // 'test'.match(/^/); RegExp['$`']
+ 'test'.match(/^/);
+ testcases[count++] = new TestCase ( SECTION, "'test'.match(/^/); RegExp['$`']",
+ '', RegExp['$`']);
+
+ // 'xxxx'.match(new RegExp('$')); RegExp['$`']
+ 'xxxx'.match(new RegExp('$'));
+ testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(new RegExp('$')); RegExp['$`']",
+ 'xxxx', RegExp['$`']);
+
+ // 'test'.match(new RegExp('^')); RegExp['$`']
+ 'test'.match(new RegExp('^'));
+ testcases[count++] = new TestCase ( SECTION, "'test'.match(new RegExp('^')); RegExp['$`']",
+ '', RegExp['$`']);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline.js
new file mode 100644
index 0000000..be22261
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline.js
@@ -0,0 +1,129 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_multiline.js
+ Description: 'Tests RegExps multiline property'
+
+ Author: Nick Lerissa
+ Date: March 12, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: multiline';
+
+ writeHeaderToLog('Executing script: RegExp_multiline.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // First we do a series of tests with RegExp.multiline set to false (default value)
+ // Following this we do the same tests with RegExp.multiline set true(**).
+ // RegExp.multiline
+ testcases[count++] = new TestCase ( SECTION, "RegExp.multiline",
+ false, RegExp.multiline);
+
+ // (multiline == false) '123\n456'.match(/^4../)
+ testcases[count++] = new TestCase ( SECTION, "(multiline == false) '123\\n456'.match(/^4../)",
+ null, '123\n456'.match(/^4../));
+
+ // (multiline == false) 'a11\na22\na23\na24'.match(/^a../g)
+ testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'a11\\na22\\na23\\na24'.match(/^a../g)",
+ String(['a11']), String('a11\na22\na23\na24'.match(/^a../g)));
+
+ // (multiline == false) 'a11\na22'.match(/^.+^./)
+ testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'a11\na22'.match(/^.+^./)",
+ null, 'a11\na22'.match(/^.+^./));
+
+ // (multiline == false) '123\n456'.match(/.3$/)
+ testcases[count++] = new TestCase ( SECTION, "(multiline == false) '123\\n456'.match(/.3$/)",
+ null, '123\n456'.match(/.3$/));
+
+ // (multiline == false) 'a11\na22\na23\na24'.match(/a..$/g)
+ testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'a11\\na22\\na23\\na24'.match(/a..$/g)",
+ String(['a24']), String('a11\na22\na23\na24'.match(/a..$/g)));
+
+ // (multiline == false) 'abc\ndef'.match(/c$...$/)
+ testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'abc\ndef'.match(/c$...$/)",
+ null, 'abc\ndef'.match(/c$...$/));
+
+ // (multiline == false) 'a11\na22\na23\na24'.match(new RegExp('a..$','g'))
+ testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))",
+ String(['a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g'))));
+
+ // (multiline == false) 'abc\ndef'.match(new RegExp('c$...$'))
+ testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'abc\ndef'.match(new RegExp('c$...$'))",
+ null, 'abc\ndef'.match(new RegExp('c$...$')));
+
+ // **Now we do the tests with RegExp.multiline set to true
+ // RegExp.multiline = true; RegExp.multiline
+ RegExp.multiline = true;
+ testcases[count++] = new TestCase ( SECTION, "RegExp.multiline = true; RegExp.multiline",
+ true, RegExp.multiline);
+
+ // (multiline == true) '123\n456'.match(/^4../)
+ testcases[count++] = new TestCase ( SECTION, "(multiline == true) '123\\n456'.match(/^4../)",
+ String(['456']), String('123\n456'.match(/^4../)));
+
+ // (multiline == true) 'a11\na22\na23\na24'.match(/^a../g)
+ testcases[count++] = new TestCase ( SECTION, "(multiline == true) 'a11\\na22\\na23\\na24'.match(/^a../g)",
+ String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/^a../g)));
+
+ // (multiline == true) 'a11\na22'.match(/^.+^./)
+ //testcases[count++] = new TestCase ( SECTION, "(multiline == true) 'a11\na22'.match(/^.+^./)",
+ // String(['a11\na']), String('a11\na22'.match(/^.+^./)));
+
+ // (multiline == true) '123\n456'.match(/.3$/)
+ testcases[count++] = new TestCase ( SECTION, "(multiline == true) '123\\n456'.match(/.3$/)",
+ String(['23']), String('123\n456'.match(/.3$/)));
+
+ // (multiline == true) 'a11\na22\na23\na24'.match(/a..$/g)
+ testcases[count++] = new TestCase ( SECTION, "(multiline == true) 'a11\\na22\\na23\\na24'.match(/a..$/g)",
+ String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/a..$/g)));
+
+ // (multiline == true) 'a11\na22\na23\na24'.match(new RegExp('a..$','g'))
+ testcases[count++] = new TestCase ( SECTION, "(multiline == true) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))",
+ String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g'))));
+
+ // (multiline == true) 'abc\ndef'.match(/c$....$/)
+ //testcases[count++] = new TestCase ( SECTION, "(multiline == true) 'abc\ndef'.match(/c$.+$/)",
+ // 'c\ndef', String('abc\ndef'.match(/c$.+$/)));
+
+ RegExp.multiline = false;
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline_as_array.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline_as_array.js
new file mode 100644
index 0000000..690653f
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline_as_array.js
@@ -0,0 +1,129 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_multiline_as_array.js
+ Description: 'Tests RegExps $* property (same tests as RegExp_multiline.js but using $*)'
+
+ Author: Nick Lerissa
+ Date: March 13, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: $*';
+
+ writeHeaderToLog('Executing script: RegExp_multiline_as_array.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // First we do a series of tests with RegExp['$*'] set to false (default value)
+ // Following this we do the same tests with RegExp['$*'] set true(**).
+ // RegExp['$*']
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$*']",
+ false, RegExp['$*']);
+
+ // (['$*'] == false) '123\n456'.match(/^4../)
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) '123\\n456'.match(/^4../)",
+ null, '123\n456'.match(/^4../));
+
+ // (['$*'] == false) 'a11\na22\na23\na24'.match(/^a../g)
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) 'a11\\na22\\na23\\na24'.match(/^a../g)",
+ String(['a11']), String('a11\na22\na23\na24'.match(/^a../g)));
+
+ // (['$*'] == false) 'a11\na22'.match(/^.+^./)
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) 'a11\na22'.match(/^.+^./)",
+ null, 'a11\na22'.match(/^.+^./));
+
+ // (['$*'] == false) '123\n456'.match(/.3$/)
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) '123\\n456'.match(/.3$/)",
+ null, '123\n456'.match(/.3$/));
+
+ // (['$*'] == false) 'a11\na22\na23\na24'.match(/a..$/g)
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) 'a11\\na22\\na23\\na24'.match(/a..$/g)",
+ String(['a24']), String('a11\na22\na23\na24'.match(/a..$/g)));
+
+ // (['$*'] == false) 'abc\ndef'.match(/c$...$/)
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) 'abc\ndef'.match(/c$...$/)",
+ null, 'abc\ndef'.match(/c$...$/));
+
+ // (['$*'] == false) 'a11\na22\na23\na24'.match(new RegExp('a..$','g'))
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))",
+ String(['a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g'))));
+
+ // (['$*'] == false) 'abc\ndef'.match(new RegExp('c$...$'))
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) 'abc\ndef'.match(new RegExp('c$...$'))",
+ null, 'abc\ndef'.match(new RegExp('c$...$')));
+
+ // **Now we do the tests with RegExp['$*'] set to true
+ // RegExp['$*'] = true; RegExp['$*']
+ RegExp['$*'] = true;
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$*'] = true; RegExp['$*']",
+ true, RegExp['$*']);
+
+ // (['$*'] == true) '123\n456'.match(/^4../)
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) '123\\n456'.match(/^4../)",
+ String(['456']), String('123\n456'.match(/^4../)));
+
+ // (['$*'] == true) 'a11\na22\na23\na24'.match(/^a../g)
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) 'a11\\na22\\na23\\na24'.match(/^a../g)",
+ String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/^a../g)));
+
+ // (['$*'] == true) 'a11\na22'.match(/^.+^./)
+ //testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) 'a11\na22'.match(/^.+^./)",
+ // String(['a11\na']), String('a11\na22'.match(/^.+^./)));
+
+ // (['$*'] == true) '123\n456'.match(/.3$/)
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) '123\\n456'.match(/.3$/)",
+ String(['23']), String('123\n456'.match(/.3$/)));
+
+ // (['$*'] == true) 'a11\na22\na23\na24'.match(/a..$/g)
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) 'a11\\na22\\na23\\na24'.match(/a..$/g)",
+ String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/a..$/g)));
+
+ // (['$*'] == true) 'a11\na22\na23\na24'.match(new RegExp('a..$','g'))
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))",
+ String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g'))));
+
+ // (['$*'] == true) 'abc\ndef'.match(/c$....$/)
+ //testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) 'abc\ndef'.match(/c$.+$/)",
+ // 'c\ndef', String('abc\ndef'.match(/c$.+$/)));
+
+ RegExp['$*'] = false;
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_object.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_object.js
new file mode 100644
index 0000000..6bf2353
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_object.js
@@ -0,0 +1,88 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_object.js
+ Description: 'Tests regular expressions creating RexExp Objects'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: object';
+
+ writeHeaderToLog('Executing script: RegExp_object.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ var SSN_pattern = new RegExp("\\d{3}-\\d{2}-\\d{4}");
+
+ // testing SSN pattern
+ testcases[count++] = new TestCase ( SECTION, "'Test SSN is 123-34-4567'.match(SSN_pattern))",
+ String(["123-34-4567"]), String('Test SSN is 123-34-4567'.match(SSN_pattern)));
+
+ // testing SSN pattern
+ testcases[count++] = new TestCase ( SECTION, "'Test SSN is 123-34-4567'.match(SSN_pattern))",
+ String(["123-34-4567"]), String('Test SSN is 123-34-4567'.match(SSN_pattern)));
+
+ var PHONE_pattern = new RegExp("\\(?(\\d{3})\\)?-?(\\d{3})-(\\d{4})");
+ // testing PHONE pattern
+ testcases[count++] = new TestCase ( SECTION, "'Our phone number is (408)345-2345.'.match(PHONE_pattern))",
+ String(["(408)345-2345","408","345","2345"]), String('Our phone number is (408)345-2345.'.match(PHONE_pattern)));
+
+ // testing PHONE pattern
+ testcases[count++] = new TestCase ( SECTION, "'The phone number is 408-345-2345!'.match(PHONE_pattern))",
+ String(["408-345-2345","408","345","2345"]), String('The phone number is 408-345-2345!'.match(PHONE_pattern)));
+
+ // testing PHONE pattern
+ testcases[count++] = new TestCase ( SECTION, "String(PHONE_pattern.toString())",
+ "/\\(?(\\d{3})\\)?-?(\\d{3})-(\\d{4})/", String(PHONE_pattern.toString()));
+
+ // testing conversion to String
+ testcases[count++] = new TestCase ( SECTION, "PHONE_pattern + ' is the string'",
+ "/\\(?(\\d{3})\\)?-?(\\d{3})-(\\d{4})/ is the string",PHONE_pattern + ' is the string');
+
+ // testing conversion to int
+ testcases[count++] = new TestCase ( SECTION, "SSN_pattern - 8",
+ NaN,SSN_pattern - 8);
+
+ var testPattern = new RegExp("(\\d+)45(\\d+)90");
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext.js
new file mode 100644
index 0000000..ede5e21
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext.js
@@ -0,0 +1,90 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_rightContext.js
+ Description: 'Tests RegExps rightContext property'
+
+ Author: Nick Lerissa
+ Date: March 12, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: rightContext';
+
+ writeHeaderToLog('Executing script: RegExp_rightContext.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abc123xyz'.match(/123/); RegExp.rightContext
+ 'abc123xyz'.match(/123/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/123/); RegExp.rightContext",
+ 'xyz', RegExp.rightContext);
+
+ // 'abc123xyz'.match(/456/); RegExp.rightContext
+ 'abc123xyz'.match(/456/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/456/); RegExp.rightContext",
+ 'xyz', RegExp.rightContext);
+
+ // 'abc123xyz'.match(/abc123xyz/); RegExp.rightContext
+ 'abc123xyz'.match(/abc123xyz/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/abc123xyz/); RegExp.rightContext",
+ '', RegExp.rightContext);
+
+ // 'xxxx'.match(/$/); RegExp.rightContext
+ 'xxxx'.match(/$/);
+ testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(/$/); RegExp.rightContext",
+ '', RegExp.rightContext);
+
+ // 'test'.match(/^/); RegExp.rightContext
+ 'test'.match(/^/);
+ testcases[count++] = new TestCase ( SECTION, "'test'.match(/^/); RegExp.rightContext",
+ 'test', RegExp.rightContext);
+
+ // 'xxxx'.match(new RegExp('$')); RegExp.rightContext
+ 'xxxx'.match(new RegExp('$'));
+ testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(new RegExp('$')); RegExp.rightContext",
+ '', RegExp.rightContext);
+
+ // 'test'.match(new RegExp('^')); RegExp.rightContext
+ 'test'.match(new RegExp('^'));
+ testcases[count++] = new TestCase ( SECTION, "'test'.match(new RegExp('^')); RegExp.rightContext",
+ 'test', RegExp.rightContext);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext_as_array.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext_as_array.js
new file mode 100644
index 0000000..e182774
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext_as_array.js
@@ -0,0 +1,90 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_rightContext_as_array.js
+ Description: 'Tests RegExps $\' property (same tests as RegExp_rightContext.js but using $\)'
+
+ Author: Nick Lerissa
+ Date: March 12, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: $\'';
+
+ writeHeaderToLog('Executing script: RegExp_rightContext.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abc123xyz'.match(/123/); RegExp['$\'']
+ 'abc123xyz'.match(/123/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/123/); RegExp['$\'']",
+ 'xyz', RegExp['$\'']);
+
+ // 'abc123xyz'.match(/456/); RegExp['$\'']
+ 'abc123xyz'.match(/456/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/456/); RegExp['$\'']",
+ 'xyz', RegExp['$\'']);
+
+ // 'abc123xyz'.match(/abc123xyz/); RegExp['$\'']
+ 'abc123xyz'.match(/abc123xyz/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/abc123xyz/); RegExp['$\'']",
+ '', RegExp['$\'']);
+
+ // 'xxxx'.match(/$/); RegExp['$\'']
+ 'xxxx'.match(/$/);
+ testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(/$/); RegExp['$\'']",
+ '', RegExp['$\'']);
+
+ // 'test'.match(/^/); RegExp['$\'']
+ 'test'.match(/^/);
+ testcases[count++] = new TestCase ( SECTION, "'test'.match(/^/); RegExp['$\'']",
+ 'test', RegExp['$\'']);
+
+ // 'xxxx'.match(new RegExp('$')); RegExp['$\'']
+ 'xxxx'.match(new RegExp('$'));
+ testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(new RegExp('$')); RegExp['$\'']",
+ '', RegExp['$\'']);
+
+ // 'test'.match(new RegExp('^')); RegExp['$\'']
+ 'test'.match(new RegExp('^'));
+ testcases[count++] = new TestCase ( SECTION, "'test'.match(new RegExp('^')); RegExp['$\'']",
+ 'test', RegExp['$\'']);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/alphanumeric.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/alphanumeric.js
new file mode 100644
index 0000000..36f5280
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/alphanumeric.js
@@ -0,0 +1,129 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: alphanumeric.js
+ Description: 'Tests regular expressions with \w and \W special characters'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: \\w and \\W';
+
+ writeHeaderToLog('Executing script: alphanumeric.js');
+ writeHeaderToLog( SECTION + " " + TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ var non_alphanumeric = "~`!@#$%^&*()-+={[}]|\\:;'<,>./?\f\n\r\t\v " + '"';
+ var alphanumeric = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
+
+ // be sure all alphanumerics are matched by \w
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + alphanumeric + "'.match(new RegExp('\\w+'))",
+ String([alphanumeric]), String(alphanumeric.match(new RegExp('\\w+'))));
+
+ // be sure all non-alphanumerics are matched by \W
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + non_alphanumeric + "'.match(new RegExp('\\W+'))",
+ String([non_alphanumeric]), String(non_alphanumeric.match(new RegExp('\\W+'))));
+
+ // be sure all non-alphanumerics are not matched by \w
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + non_alphanumeric + "'.match(new RegExp('\\w'))",
+ null, non_alphanumeric.match(new RegExp('\\w')));
+
+ // be sure all alphanumerics are not matched by \W
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + alphanumeric + "'.match(new RegExp('\\W'))",
+ null, alphanumeric.match(new RegExp('\\W')));
+
+ var s = non_alphanumeric + alphanumeric;
+
+ // be sure all alphanumerics are matched by \w
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\w+'))",
+ String([alphanumeric]), String(s.match(new RegExp('\\w+'))));
+
+ s = alphanumeric + non_alphanumeric;
+
+ // be sure all non-alphanumerics are matched by \W
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\W+'))",
+ String([non_alphanumeric]), String(s.match(new RegExp('\\W+'))));
+
+ // be sure all alphanumerics are matched by \w (using literals)
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(/\w+/)",
+ String([alphanumeric]), String(s.match(/\w+/)));
+
+ s = alphanumeric + non_alphanumeric;
+
+ // be sure all non-alphanumerics are matched by \W (using literals)
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(/\W+/)",
+ String([non_alphanumeric]), String(s.match(/\W+/)));
+
+ s = 'abcd*&^%$$';
+ // be sure the following test behaves consistently
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(/(\w+)...(\W+)/)",
+ String([s , 'abcd' , '%$$']), String(s.match(/(\w+)...(\W+)/)));
+
+ var i;
+
+ // be sure all alphanumeric characters match individually
+ for (i = 0; i < alphanumeric.length; ++i)
+ {
+ s = '#$' + alphanumeric[i] + '%^';
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\w'))",
+ String([alphanumeric[i]]), String(s.match(new RegExp('\\w'))));
+ }
+ // be sure all non_alphanumeric characters match individually
+ for (i = 0; i < non_alphanumeric.length; ++i)
+ {
+ s = 'sd' + non_alphanumeric[i] + String((i+10) * (i+10) - 2 * (i+10));
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\W'))",
+ String([non_alphanumeric[i]]), String(s.match(new RegExp('\\W'))));
+ }
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/asterisk.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/asterisk.js
new file mode 100644
index 0000000..dfa8343
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/asterisk.js
@@ -0,0 +1,105 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: asterisk.js
+ Description: 'Tests regular expressions containing *'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: *';
+
+ writeHeaderToLog('Executing script: aterisk.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcddddefg'.match(new RegExp('d*'))
+ testcases[count++] = new TestCase ( SECTION, "'abcddddefg'.match(new RegExp('d*'))",
+ String([""]), String('abcddddefg'.match(new RegExp('d*'))));
+
+ // 'abcddddefg'.match(new RegExp('cd*'))
+ testcases[count++] = new TestCase ( SECTION, "'abcddddefg'.match(new RegExp('cd*'))",
+ String(["cdddd"]), String('abcddddefg'.match(new RegExp('cd*'))));
+
+ // 'abcdefg'.match(new RegExp('cx*d'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('cx*d'))",
+ String(["cd"]), String('abcdefg'.match(new RegExp('cx*d'))));
+
+ // 'xxxxxxx'.match(new RegExp('(x*)(x+)'))
+ testcases[count++] = new TestCase ( SECTION, "'xxxxxxx'.match(new RegExp('(x*)(x+)'))",
+ String(["xxxxxxx","xxxxxx","x"]), String('xxxxxxx'.match(new RegExp('(x*)(x+)'))));
+
+ // '1234567890'.match(new RegExp('(\\d*)(\\d+)'))
+ testcases[count++] = new TestCase ( SECTION, "'1234567890'.match(new RegExp('(\\d*)(\\d+)'))",
+ String(["1234567890","123456789","0"]),
+ String('1234567890'.match(new RegExp('(\\d*)(\\d+)'))));
+
+ // '1234567890'.match(new RegExp('(\\d*)\\d(\\d+)'))
+ testcases[count++] = new TestCase ( SECTION, "'1234567890'.match(new RegExp('(\\d*)\\d(\\d+)'))",
+ String(["1234567890","12345678","0"]),
+ String('1234567890'.match(new RegExp('(\\d*)\\d(\\d+)'))));
+
+ // 'xxxxxxx'.match(new RegExp('(x+)(x*)'))
+ testcases[count++] = new TestCase ( SECTION, "'xxxxxxx'.match(new RegExp('(x+)(x*)'))",
+ String(["xxxxxxx","xxxxxxx",""]), String('xxxxxxx'.match(new RegExp('(x+)(x*)'))));
+
+ // 'xxxxxxyyyyyy'.match(new RegExp('x*y+$'))
+ testcases[count++] = new TestCase ( SECTION, "'xxxxxxyyyyyy'.match(new RegExp('x*y+$'))",
+ String(["xxxxxxyyyyyy"]), String('xxxxxxyyyyyy'.match(new RegExp('x*y+$'))));
+
+ // 'abcdef'.match(/[\d]*[\s]*bc./)
+ testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(/[\\d]*[\\s]*bc./)",
+ String(["bcd"]), String('abcdef'.match(/[\d]*[\s]*bc./)));
+
+ // 'abcdef'.match(/bc..[\d]*[\s]*/)
+ testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(/bc..[\\d]*[\\s]*/)",
+ String(["bcde"]), String('abcdef'.match(/bc..[\d]*[\s]*/)));
+
+ // 'a1b2c3'.match(/.*/)
+ testcases[count++] = new TestCase ( SECTION, "'a1b2c3'.match(/.*/)",
+ String(["a1b2c3"]), String('a1b2c3'.match(/.*/)));
+
+ // 'a0.b2.c3'.match(/[xyz]*1/)
+ testcases[count++] = new TestCase ( SECTION, "'a0.b2.c3'.match(/[xyz]*1/)",
+ null, 'a0.b2.c3'.match(/[xyz]*1/));
+
+function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/backslash.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/backslash.js
new file mode 100644
index 0000000..61c5d61
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/backslash.js
@@ -0,0 +1,79 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: backslash.js
+ Description: 'Tests regular expressions containing \'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: \\';
+
+ writeHeaderToLog('Executing script: backslash.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcde'.match(new RegExp('\e'))
+ testcases[count++] = new TestCase ( SECTION, "'abcde'.match(new RegExp('\e'))",
+ String(["e"]), String('abcde'.match(new RegExp('\e'))));
+
+ // 'ab\\cde'.match(new RegExp('\\\\'))
+ testcases[count++] = new TestCase ( SECTION, "'ab\\cde'.match(new RegExp('\\\\'))",
+ String(["\\"]), String('ab\\cde'.match(new RegExp('\\\\'))));
+
+ // 'ab\\cde'.match(/\\/) (using literal)
+ testcases[count++] = new TestCase ( SECTION, "'ab\\cde'.match(/\\\\/)",
+ String(["\\"]), String('ab\\cde'.match(/\\/)));
+
+ // 'before ^$*+?.()|{}[] after'.match(new RegExp('\^\$\*\+\?\.\(\)\|\{\}\[\]'))
+ testcases[count++] = new TestCase ( SECTION,
+ "'before ^$*+?.()|{}[] after'.match(new RegExp('\\^\\$\\*\\+\\?\\.\\(\\)\\|\\{\\}\\[\\]'))",
+ String(["^$*+?.()|{}[]"]),
+ String('before ^$*+?.()|{}[] after'.match(new RegExp('\\^\\$\\*\\+\\?\\.\\(\\)\\|\\{\\}\\[\\]'))));
+
+ // 'before ^$*+?.()|{}[] after'.match(/\^\$\*\+\?\.\(\)\|\{\}\[\]/) (using literal)
+ testcases[count++] = new TestCase ( SECTION,
+ "'before ^$*+?.()|{}[] after'.match(/\\^\\$\\*\\+\\?\\.\\(\\)\\|\\{\\}\\[\\]/)",
+ String(["^$*+?.()|{}[]"]),
+ String('before ^$*+?.()|{}[] after'.match(/\^\$\*\+\?\.\(\)\|\{\}\[\]/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/backspace.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/backspace.js
new file mode 100644
index 0000000..bd3c064
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/backspace.js
@@ -0,0 +1,79 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: backspace.js
+ Description: 'Tests regular expressions containing [\b]'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: [\b]';
+
+ writeHeaderToLog('Executing script: backspace.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abc\bdef'.match(new RegExp('.[\b].'))
+ testcases[count++] = new TestCase ( SECTION, "'abc\bdef'.match(new RegExp('.[\\b].'))",
+ String(["c\bd"]), String('abc\bdef'.match(new RegExp('.[\\b].'))));
+
+ // 'abc\\bdef'.match(new RegExp('.[\b].'))
+ testcases[count++] = new TestCase ( SECTION, "'abc\\bdef'.match(new RegExp('.[\\b].'))",
+ null, 'abc\\bdef'.match(new RegExp('.[\\b].')));
+
+ // 'abc\b\b\bdef'.match(new RegExp('c[\b]{3}d'))
+ testcases[count++] = new TestCase ( SECTION, "'abc\b\b\bdef'.match(new RegExp('c[\\b]{3}d'))",
+ String(["c\b\b\bd"]), String('abc\b\b\bdef'.match(new RegExp('c[\\b]{3}d'))));
+
+ // 'abc\bdef'.match(new RegExp('[^\\[\b\\]]+'))
+ testcases[count++] = new TestCase ( SECTION, "'abc\bdef'.match(new RegExp('[^\\[\\b\\]]+'))",
+ String(["abc"]), String('abc\bdef'.match(new RegExp('[^\\[\\b\\]]+'))));
+
+ // 'abcdef'.match(new RegExp('[^\\[\b\\]]+'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(new RegExp('[^\\[\\b\\]]+'))",
+ String(["abcdef"]), String('abcdef'.match(new RegExp('[^\\[\\b\\]]+'))));
+
+ // 'abcdef'.match(/[^\[\b\]]+/)
+ testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(/[^\\[\\b\\]]+/)",
+ String(["abcdef"]), String('abcdef'.match(/[^\[\b\]]+/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/beginLine.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/beginLine.js
new file mode 100644
index 0000000..c5ccbdc
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/beginLine.js
@@ -0,0 +1,80 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: beginLine.js
+ Description: 'Tests regular expressions containing ^'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: ^';
+
+ writeHeaderToLog('Executing script: beginLine.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcde'.match(new RegExp('^ab'))
+ testcases[count++] = new TestCase ( SECTION, "'abcde'.match(new RegExp('^ab'))",
+ String(["ab"]), String('abcde'.match(new RegExp('^ab'))));
+
+ // 'ab\ncde'.match(new RegExp('^..^e'))
+ testcases[count++] = new TestCase ( SECTION, "'ab\ncde'.match(new RegExp('^..^e'))",
+ null, 'ab\ncde'.match(new RegExp('^..^e')));
+
+ // 'yyyyy'.match(new RegExp('^xxx'))
+ testcases[count++] = new TestCase ( SECTION, "'yyyyy'.match(new RegExp('^xxx'))",
+ null, 'yyyyy'.match(new RegExp('^xxx')));
+
+ // '^^^x'.match(new RegExp('^\\^+'))
+ testcases[count++] = new TestCase ( SECTION, "'^^^x'.match(new RegExp('^\\^+'))",
+ String(['^^^']), String('^^^x'.match(new RegExp('^\\^+'))));
+
+ // '^^^x'.match(/^\^+/)
+ testcases[count++] = new TestCase ( SECTION, "'^^^x'.match(/^\\^+/)",
+ String(['^^^']), String('^^^x'.match(/^\^+/)));
+
+ RegExp.multiline = true;
+ // 'abc\n123xyz'.match(new RegExp('^\d+')) <multiline==true>
+ testcases[count++] = new TestCase ( SECTION, "'abc\n123xyz'.match(new RegExp('^\\d+'))",
+ String(['123']), String('abc\n123xyz'.match(new RegExp('^\\d+'))));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/character_class.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/character_class.js
new file mode 100644
index 0000000..da0b59e
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/character_class.js
@@ -0,0 +1,107 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: character_class.js
+ Description: 'Tests regular expressions containing []'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: []';
+
+ writeHeaderToLog('Executing script: character_class.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcde'.match(new RegExp('ab[ercst]de'))
+ testcases[count++] = new TestCase ( SECTION, "'abcde'.match(new RegExp('ab[ercst]de'))",
+ String(["abcde"]), String('abcde'.match(new RegExp('ab[ercst]de'))));
+
+ // 'abcde'.match(new RegExp('ab[erst]de'))
+ testcases[count++] = new TestCase ( SECTION, "'abcde'.match(new RegExp('ab[erst]de'))",
+ null, 'abcde'.match(new RegExp('ab[erst]de')));
+
+ // 'abcdefghijkl'.match(new RegExp('[d-h]+'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghijkl'.match(new RegExp('[d-h]+'))",
+ String(["defgh"]), String('abcdefghijkl'.match(new RegExp('[d-h]+'))));
+
+ // 'abc6defghijkl'.match(new RegExp('[1234567].{2}'))
+ testcases[count++] = new TestCase ( SECTION, "'abc6defghijkl'.match(new RegExp('[1234567].{2}'))",
+ String(["6de"]), String('abc6defghijkl'.match(new RegExp('[1234567].{2}'))));
+
+ // '\n\n\abc324234\n'.match(new RegExp('[a-c\d]+'))
+ testcases[count++] = new TestCase ( SECTION, "'\n\n\abc324234\n'.match(new RegExp('[a-c\\d]+'))",
+ String(["abc324234"]), String('\n\n\abc324234\n'.match(new RegExp('[a-c\\d]+'))));
+
+ // 'abc'.match(new RegExp('ab[.]?c'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('ab[.]?c'))",
+ String(["abc"]), String('abc'.match(new RegExp('ab[.]?c'))));
+
+ // 'abc'.match(new RegExp('a[b]c'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('a[b]c'))",
+ String(["abc"]), String('abc'.match(new RegExp('a[b]c'))));
+
+ // 'a1b b2c c3d def f4g'.match(new RegExp('[a-z][^1-9][a-z]'))
+ testcases[count++] = new TestCase ( SECTION, "'a1b b2c c3d def f4g'.match(new RegExp('[a-z][^1-9][a-z]'))",
+ String(["def"]), String('a1b b2c c3d def f4g'.match(new RegExp('[a-z][^1-9][a-z]'))));
+
+ // '123*&$abc'.match(new RegExp('[*&$]{3}'))
+ testcases[count++] = new TestCase ( SECTION, "'123*&$abc'.match(new RegExp('[*&$]{3}'))",
+ String(["*&$"]), String('123*&$abc'.match(new RegExp('[*&$]{3}'))));
+
+ // 'abc'.match(new RegExp('a[^1-9]c'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('a[^1-9]c'))",
+ String(["abc"]), String('abc'.match(new RegExp('a[^1-9]c'))));
+
+ // 'abc'.match(new RegExp('a[^b]c'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('a[^b]c'))",
+ null, 'abc'.match(new RegExp('a[^b]c')));
+
+ // 'abc#$%def%&*@ghi)(*&'.match(new RegExp('[^a-z]{4}'))
+ testcases[count++] = new TestCase ( SECTION, "'abc#$%def%&*@ghi)(*&'.match(new RegExp('[^a-z]{4}'))",
+ String(["%&*@"]), String('abc#$%def%&*@ghi)(*&'.match(new RegExp('[^a-z]{4}'))));
+
+ // 'abc#$%def%&*@ghi)(*&'.match(/[^a-z]{4}/)
+ testcases[count++] = new TestCase ( SECTION, "'abc#$%def%&*@ghi)(*&'.match(/[^a-z]{4}/)",
+ String(["%&*@"]), String('abc#$%def%&*@ghi)(*&'.match(/[^a-z]{4}/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/compile.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/compile.js
new file mode 100644
index 0000000..973fff2
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/compile.js
@@ -0,0 +1,94 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: compile.js
+ Description: 'Tests regular expressions method compile'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: compile';
+
+ writeHeaderToLog('Executing script: compile.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ var regularExpression = new RegExp();
+
+ regularExpression.compile("[0-9]{3}x[0-9]{4}","i");
+
+ testcases[count++] = new TestCase ( SECTION,
+ "(compile '[0-9]{3}x[0-9]{4}','i')",
+ String(["456X7890"]), String('234X456X7890'.match(regularExpression)));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "source of (compile '[0-9]{3}x[0-9]{4}','i')",
+ "[0-9]{3}x[0-9]{4}", regularExpression.source);
+
+ testcases[count++] = new TestCase ( SECTION,
+ "global of (compile '[0-9]{3}x[0-9]{4}','i')",
+ false, regularExpression.global);
+
+ testcases[count++] = new TestCase ( SECTION,
+ "ignoreCase of (compile '[0-9]{3}x[0-9]{4}','i')",
+ true, regularExpression.ignoreCase);
+
+ regularExpression.compile("[0-9]{3}X[0-9]{3}","g");
+
+ testcases[count++] = new TestCase ( SECTION,
+ "(compile '[0-9]{3}X[0-9]{3}','g')",
+ String(["234X456"]), String('234X456X7890'.match(regularExpression)));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "source of (compile '[0-9]{3}X[0-9]{3}','g')",
+ "[0-9]{3}X[0-9]{3}", regularExpression.source);
+
+ testcases[count++] = new TestCase ( SECTION,
+ "global of (compile '[0-9]{3}X[0-9]{3}','g')",
+ true, regularExpression.global);
+
+ testcases[count++] = new TestCase ( SECTION,
+ "ignoreCase of (compile '[0-9]{3}X[0-9]{3}','g')",
+ false, regularExpression.ignoreCase);
+
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/control_characters.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/control_characters.js
new file mode 100644
index 0000000..fb54a7f
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/control_characters.js
@@ -0,0 +1,71 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: control_characters.js
+ Description: 'Tests regular expressions containing .'
+
+ Author: Nick Lerissa
+ Date: April 8, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: .';
+ var BUGNUMBER="123802";
+
+ writeHeaderToLog('Executing script: control_characters.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'àOÐ ê:i¢Ø'.match(new RegExp('.+'))
+ testcases[count++] = new TestCase ( SECTION, "'àOÐ ê:i¢Ø'.match(new RegExp('.+'))",
+ String(['àOÐ ê:i¢Ø']), String('àOÐ ê:i¢Ø'.match(new RegExp('.+'))));
+
+ // string1.match(new RegExp(string1))
+ var string1 = 'àOÐ ê:i¢Ø';
+ testcases[count++] = new TestCase ( SECTION, "string1 = " + string1 + " string1.match(string1)",
+ String([string1]), String(string1.match(string1)));
+
+ string1 = "";
+ for (var i = 0; i < 32; i++)
+ string1 += String.fromCharCode(i);
+ testcases[count++] = new TestCase ( SECTION, "string1 = " + string1 + " string1.match(string1)",
+ String([string1]), String(string1.match(string1)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/digit.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/digit.js
new file mode 100644
index 0000000..d476823
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/digit.js
@@ -0,0 +1,119 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: digit.js
+ Description: 'Tests regular expressions containing \d'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: \\d';
+
+ writeHeaderToLog('Executing script: digit.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ var non_digits = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\f\n\r\t\v~`!@#$%^&*()-+={[}]|\\:;'<,>./? " + '"';
+
+ var digits = "1234567890";
+
+ // be sure all digits are matched by \d
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + digits + "'.match(new RegExp('\\d+'))",
+ String([digits]), String(digits.match(new RegExp('\\d+'))));
+
+ // be sure all non-digits are matched by \D
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + non_digits + "'.match(new RegExp('\\D+'))",
+ String([non_digits]), String(non_digits.match(new RegExp('\\D+'))));
+
+ // be sure all non-digits are not matched by \d
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + non_digits + "'.match(new RegExp('\\d'))",
+ null, non_digits.match(new RegExp('\\d')));
+
+ // be sure all digits are not matched by \D
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + digits + "'.match(new RegExp('\\D'))",
+ null, digits.match(new RegExp('\\D')));
+
+ var s = non_digits + digits;
+
+ // be sure all digits are matched by \d
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\d+'))",
+ String([digits]), String(s.match(new RegExp('\\d+'))));
+
+ var s = digits + non_digits;
+
+ // be sure all non-digits are matched by \D
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\D+'))",
+ String([non_digits]), String(s.match(new RegExp('\\D+'))));
+
+ var i;
+
+ // be sure all digits match individually
+ for (i = 0; i < digits.length; ++i)
+ {
+ s = 'ab' + digits[i] + 'cd';
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\d'))",
+ String([digits[i]]), String(s.match(new RegExp('\\d'))));
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(/\\d/)",
+ String([digits[i]]), String(s.match(/\d/)));
+ }
+ // be sure all non_digits match individually
+ for (i = 0; i < non_digits.length; ++i)
+ {
+ s = '12' + non_digits[i] + '34';
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\D'))",
+ String([non_digits[i]]), String(s.match(new RegExp('\\D'))));
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(/\\D/)",
+ String([non_digits[i]]), String(s.match(/\D/)));
+ }
+
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/dot.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/dot.js
new file mode 100644
index 0000000..1e9bbab
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/dot.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: dot.js
+ Description: 'Tests regular expressions containing .'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: .';
+
+ writeHeaderToLog('Executing script: dot.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcde'.match(new RegExp('ab.de'))
+ testcases[count++] = new TestCase ( SECTION, "'abcde'.match(new RegExp('ab.de'))",
+ String(["abcde"]), String('abcde'.match(new RegExp('ab.de'))));
+
+ // 'line 1\nline 2'.match(new RegExp('.+'))
+ testcases[count++] = new TestCase ( SECTION, "'line 1\nline 2'.match(new RegExp('.+'))",
+ String(["line 1"]), String('line 1\nline 2'.match(new RegExp('.+'))));
+
+ // 'this is a test'.match(new RegExp('.*a.*'))
+ testcases[count++] = new TestCase ( SECTION, "'this is a test'.match(new RegExp('.*a.*'))",
+ String(["this is a test"]), String('this is a test'.match(new RegExp('.*a.*'))));
+
+ // 'this is a *&^%$# test'.match(new RegExp('.+'))
+ testcases[count++] = new TestCase ( SECTION, "'this is a *&^%$# test'.match(new RegExp('.+'))",
+ String(["this is a *&^%$# test"]), String('this is a *&^%$# test'.match(new RegExp('.+'))));
+
+ // '....'.match(new RegExp('.+'))
+ testcases[count++] = new TestCase ( SECTION, "'....'.match(new RegExp('.+'))",
+ String(["...."]), String('....'.match(new RegExp('.+'))));
+
+ // 'abcdefghijklmnopqrstuvwxyz'.match(new RegExp('.+'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghijklmnopqrstuvwxyz'.match(new RegExp('.+'))",
+ String(["abcdefghijklmnopqrstuvwxyz"]), String('abcdefghijklmnopqrstuvwxyz'.match(new RegExp('.+'))));
+
+ // 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.match(new RegExp('.+'))
+ testcases[count++] = new TestCase ( SECTION, "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.match(new RegExp('.+'))",
+ String(["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]), String('ABCDEFGHIJKLMNOPQRSTUVWXYZ'.match(new RegExp('.+'))));
+
+ // '`1234567890-=~!@#$%^&*()_+'.match(new RegExp('.+'))
+ testcases[count++] = new TestCase ( SECTION, "'`1234567890-=~!@#$%^&*()_+'.match(new RegExp('.+'))",
+ String(["`1234567890-=~!@#$%^&*()_+"]), String('`1234567890-=~!@#$%^&*()_+'.match(new RegExp('.+'))));
+
+ // '|\\[{]};:"\',<>.?/'.match(new RegExp('.+'))
+ testcases[count++] = new TestCase ( SECTION, "'|\\[{]};:\"\',<>.?/'.match(new RegExp('.+'))",
+ String(["|\\[{]};:\"\',<>.?/"]), String('|\\[{]};:\"\',<>.?/'.match(new RegExp('.+'))));
+
+ // '|\\[{]};:"\',<>.?/'.match(/.+/)
+ testcases[count++] = new TestCase ( SECTION, "'|\\[{]};:\"\',<>.?/'.match(/.+/)",
+ String(["|\\[{]};:\"\',<>.?/"]), String('|\\[{]};:\"\',<>.?/'.match(/.+/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/endLine.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/endLine.js
new file mode 100644
index 0000000..655d6ec
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/endLine.js
@@ -0,0 +1,80 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: endLine.js
+ Description: 'Tests regular expressions containing $'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: $';
+
+ writeHeaderToLog('Executing script: endLine.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcde'.match(new RegExp('de$'))
+ testcases[count++] = new TestCase ( SECTION, "'abcde'.match(new RegExp('de$'))",
+ String(["de"]), String('abcde'.match(new RegExp('de$'))));
+
+ // 'ab\ncde'.match(new RegExp('..$e$'))
+ testcases[count++] = new TestCase ( SECTION, "'ab\ncde'.match(new RegExp('..$e$'))",
+ null, 'ab\ncde'.match(new RegExp('..$e$')));
+
+ // 'yyyyy'.match(new RegExp('xxx$'))
+ testcases[count++] = new TestCase ( SECTION, "'yyyyy'.match(new RegExp('xxx$'))",
+ null, 'yyyyy'.match(new RegExp('xxx$')));
+
+ // 'a$$$'.match(new RegExp('\\$+$'))
+ testcases[count++] = new TestCase ( SECTION, "'a$$$'.match(new RegExp('\\$+$'))",
+ String(['$$$']), String('a$$$'.match(new RegExp('\\$+$'))));
+
+ // 'a$$$'.match(/\$+$/)
+ testcases[count++] = new TestCase ( SECTION, "'a$$$'.match(/\\$+$/)",
+ String(['$$$']), String('a$$$'.match(/\$+$/)));
+
+ RegExp.multiline = true;
+ // 'abc\n123xyz890\nxyz'.match(new RegExp('\d+$')) <multiline==true>
+ testcases[count++] = new TestCase ( SECTION, "'abc\n123xyz890\nxyz'.match(new RegExp('\\d+$'))",
+ String(['890']), String('abc\n123xyz890\nxyz'.match(new RegExp('\\d+$'))));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/everything.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/everything.js
new file mode 100644
index 0000000..1cb6acb
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/everything.js
@@ -0,0 +1,80 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: everything.js
+ Description: 'Tests regular expressions'
+
+ Author: Nick Lerissa
+ Date: March 24, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp';
+
+ writeHeaderToLog('Executing script: everything.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'Sally and Fred are sure to come.'.match(/^[a-z\s]*/i)
+ testcases[count++] = new TestCase ( SECTION, "'Sally and Fred are sure to come'.match(/^[a-z\\s]*/i)",
+ String(["Sally and Fred are sure to come"]), String('Sally and Fred are sure to come'.match(/^[a-z\s]*/i)));
+
+ // 'test123W+xyz'.match(new RegExp('^[a-z]*[0-9]+[A-Z]?.(123|xyz)$'))
+ testcases[count++] = new TestCase ( SECTION, "'test123W+xyz'.match(new RegExp('^[a-z]*[0-9]+[A-Z]?.(123|xyz)$'))",
+ String(["test123W+xyz","xyz"]), String('test123W+xyz'.match(new RegExp('^[a-z]*[0-9]+[A-Z]?.(123|xyz)$'))));
+
+ // 'number one 12365 number two 9898'.match(/(\d+)\D+(\d+)/)
+ testcases[count++] = new TestCase ( SECTION, "'number one 12365 number two 9898'.match(/(\d+)\D+(\d+)/)",
+ String(["12365 number two 9898","12365","9898"]), String('number one 12365 number two 9898'.match(/(\d+)\D+(\d+)/)));
+
+ var simpleSentence = /(\s?[^\!\?\.]+[\!\?\.])+/;
+ // 'See Spot run.'.match(simpleSentence)
+ testcases[count++] = new TestCase ( SECTION, "'See Spot run.'.match(simpleSentence)",
+ String(["See Spot run.","See Spot run."]), String('See Spot run.'.match(simpleSentence)));
+
+ // 'I like it. What's up? I said NO!'.match(simpleSentence)
+ testcases[count++] = new TestCase ( SECTION, "'I like it. What's up? I said NO!'.match(simpleSentence)",
+ String(["I like it. What's up? I said NO!",' I said NO!']), String('I like it. What\'s up? I said NO!'.match(simpleSentence)));
+
+ // 'the quick brown fox jumped over the lazy dogs'.match(/((\w+)\s*)+/)
+ testcases[count++] = new TestCase ( SECTION, "'the quick brown fox jumped over the lazy dogs'.match(/((\\w+)\\s*)+/)",
+ String(['the quick brown fox jumped over the lazy dogs','dogs','dogs']),String('the quick brown fox jumped over the lazy dogs'.match(/((\w+)\s*)+/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/exec.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/exec.js
new file mode 100644
index 0000000..f1a9d8b
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/exec.js
@@ -0,0 +1,77 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: exec.js
+ Description: 'Tests regular expressions exec compile'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: exec';
+
+ writeHeaderToLog('Executing script: exec.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ testcases[count++] = new TestCase ( SECTION,
+ "/[0-9]{3}/.exec('23 2 34 678 9 09')",
+ String(["678"]), String(/[0-9]{3}/.exec('23 2 34 678 9 09')));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "/3.{4}8/.exec('23 2 34 678 9 09')",
+ String(["34 678"]), String(/3.{4}8/.exec('23 2 34 678 9 09')));
+
+ var re = new RegExp('3.{4}8');
+ testcases[count++] = new TestCase ( SECTION,
+ "re.exec('23 2 34 678 9 09')",
+ String(["34 678"]), String(re.exec('23 2 34 678 9 09')));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "(/3.{4}8/.exec('23 2 34 678 9 09').length",
+ 1, (/3.{4}8/.exec('23 2 34 678 9 09')).length);
+
+ re = new RegExp('3.{4}8');
+ testcases[count++] = new TestCase ( SECTION,
+ "(re.exec('23 2 34 678 9 09').length",
+ 1, (re.exec('23 2 34 678 9 09')).length);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/flags.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/flags.js
new file mode 100644
index 0000000..5c25c8f
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/flags.js
@@ -0,0 +1,84 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: regexp.js
+ Description: 'Tests regular expressions using flags "i" and "g"'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'regular expression flags with flags "i" and "g"';
+
+ writeHeaderToLog('Executing script: flags.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // testing optional flag 'i'
+ testcases[count++] = new TestCase ( SECTION, "'aBCdEfGHijKLmno'.match(/fghijk/i)",
+ String(["fGHijK"]), String('aBCdEfGHijKLmno'.match(/fghijk/i)));
+
+ testcases[count++] = new TestCase ( SECTION, "'aBCdEfGHijKLmno'.match(new RegExp('fghijk','i'))",
+ String(["fGHijK"]), String('aBCdEfGHijKLmno'.match(new RegExp("fghijk","i"))));
+
+ // testing optional flag 'g'
+ testcases[count++] = new TestCase ( SECTION, "'xa xb xc xd xe xf'.match(/x./g)",
+ String(["xa","xb","xc","xd","xe","xf"]), String('xa xb xc xd xe xf'.match(/x./g)));
+
+ testcases[count++] = new TestCase ( SECTION, "'xa xb xc xd xe xf'.match(new RegExp('x.','g'))",
+ String(["xa","xb","xc","xd","xe","xf"]), String('xa xb xc xd xe xf'.match(new RegExp('x.','g'))));
+
+ // testing optional flags 'g' and 'i'
+ testcases[count++] = new TestCase ( SECTION, "'xa Xb xc xd Xe xf'.match(/x./gi)",
+ String(["xa","Xb","xc","xd","Xe","xf"]), String('xa Xb xc xd Xe xf'.match(/x./gi)));
+
+ testcases[count++] = new TestCase ( SECTION, "'xa Xb xc xd Xe xf'.match(new RegExp('x.','gi'))",
+ String(["xa","Xb","xc","xd","Xe","xf"]), String('xa Xb xc xd Xe xf'.match(new RegExp('x.','gi'))));
+
+ testcases[count++] = new TestCase ( SECTION, "'xa Xb xc xd Xe xf'.match(/x./ig)",
+ String(["xa","Xb","xc","xd","Xe","xf"]), String('xa Xb xc xd Xe xf'.match(/x./ig)));
+
+ testcases[count++] = new TestCase ( SECTION, "'xa Xb xc xd Xe xf'.match(new RegExp('x.','ig'))",
+ String(["xa","Xb","xc","xd","Xe","xf"]), String('xa Xb xc xd Xe xf'.match(new RegExp('x.','ig'))));
+
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/global.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/global.js
new file mode 100644
index 0000000..ce43520
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/global.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: global.js
+ Description: 'Tests RegExp attribute global'
+
+ Author: Nick Lerissa
+ Date: March 13, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: global';
+
+ writeHeaderToLog('Executing script: global.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // /xyz/g.global
+ testcases[count++] = new TestCase ( SECTION, "/xyz/g.global",
+ true, /xyz/g.global);
+
+ // /xyz/.global
+ testcases[count++] = new TestCase ( SECTION, "/xyz/.global",
+ false, /xyz/.global);
+
+ // '123 456 789'.match(/\d+/g)
+ testcases[count++] = new TestCase ( SECTION, "'123 456 789'.match(/\\d+/g)",
+ String(["123","456","789"]), String('123 456 789'.match(/\d+/g)));
+
+ // '123 456 789'.match(/(\d+)/g)
+ testcases[count++] = new TestCase ( SECTION, "'123 456 789'.match(/(\\d+)/g)",
+ String(["123","456","789"]), String('123 456 789'.match(/(\d+)/g)));
+
+ // '123 456 789'.match(/\d+/)
+ testcases[count++] = new TestCase ( SECTION, "'123 456 789'.match(/\\d+/)",
+ String(["123"]), String('123 456 789'.match(/\d+/)));
+
+ // (new RegExp('[a-z]','g')).global
+ testcases[count++] = new TestCase ( SECTION, "(new RegExp('[a-z]','g')).global",
+ true, (new RegExp('[a-z]','g')).global);
+
+ // (new RegExp('[a-z]','i')).global
+ testcases[count++] = new TestCase ( SECTION, "(new RegExp('[a-z]','i')).global",
+ false, (new RegExp('[a-z]','i')).global);
+
+ // '123 456 789'.match(new RegExp('\\d+','g'))
+ testcases[count++] = new TestCase ( SECTION, "'123 456 789'.match(new RegExp('\\\\d+','g'))",
+ String(["123","456","789"]), String('123 456 789'.match(new RegExp('\\d+','g'))));
+
+ // '123 456 789'.match(new RegExp('(\\d+)','g'))
+ testcases[count++] = new TestCase ( SECTION, "'123 456 789'.match(new RegExp('(\\\\d+)','g'))",
+ String(["123","456","789"]), String('123 456 789'.match(new RegExp('(\\d+)','g'))));
+
+ // '123 456 789'.match(new RegExp('\\d+','i'))
+ testcases[count++] = new TestCase ( SECTION, "'123 456 789'.match(new RegExp('\\\\d+','i'))",
+ String(["123"]), String('123 456 789'.match(new RegExp('\\d+','i'))));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/hexadecimal.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/hexadecimal.js
new file mode 100644
index 0000000..8f68c9a
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/hexadecimal.js
@@ -0,0 +1,108 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: hexadecimal.js
+ Description: 'Tests regular expressions containing \<number> '
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: \x# (hex) ';
+
+ writeHeaderToLog('Executing script: hexadecimal.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ var testPattern = '\\x41\\x42\\x43\\x44\\x45\\x46\\x47\\x48\\x49\\x4A\\x4B\\x4C\\x4D\\x4E\\x4F\\x50\\x51\\x52\\x53\\x54\\x55\\x56\\x57\\x58\\x59\\x5A';
+
+ var testString = "12345ABCDEFGHIJKLMNOPQRSTUVWXYZ67890";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
+ String(["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]), String(testString.match(new RegExp(testPattern))));
+
+ testPattern = '\\x61\\x62\\x63\\x64\\x65\\x66\\x67\\x68\\x69\\x6A\\x6B\\x6C\\x6D\\x6E\\x6F\\x70\\x71\\x72\\x73\\x74\\x75\\x76\\x77\\x78\\x79\\x7A';
+
+ testString = "12345AabcdefghijklmnopqrstuvwxyzZ67890";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
+ String(["abcdefghijklmnopqrstuvwxyz"]), String(testString.match(new RegExp(testPattern))));
+
+ testPattern = '\\x20\\x21\\x22\\x23\\x24\\x25\\x26\\x27\\x28\\x29\\x2A\\x2B\\x2C\\x2D\\x2E\\x2F\\x30\\x31\\x32\\x33';
+
+ testString = "abc !\"#$%&'()*+,-./0123ZBC";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
+ String([" !\"#$%&'()*+,-./0123"]), String(testString.match(new RegExp(testPattern))));
+
+ testPattern = '\\x34\\x35\\x36\\x37\\x38\\x39\\x3A\\x3B\\x3C\\x3D\\x3E\\x3F\\x40';
+
+ testString = "123456789:;<=>?@ABC";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
+ String(["456789:;<=>?@"]), String(testString.match(new RegExp(testPattern))));
+
+ testPattern = '\\x7B\\x7C\\x7D\\x7E';
+
+ testString = "1234{|}~ABC";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
+ String(["{|}~"]), String(testString.match(new RegExp(testPattern))));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'canthisbeFOUND'.match(new RegExp('[A-\\x5A]+'))",
+ String(["FOUND"]), String('canthisbeFOUND'.match(new RegExp('[A-\\x5A]+'))));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'canthisbeFOUND'.match(new RegExp('[\\x61-\\x7A]+'))",
+ String(["canthisbe"]), String('canthisbeFOUND'.match(new RegExp('[\\x61-\\x7A]+'))));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'canthisbeFOUND'.match(/[\\x61-\\x7A]+/)",
+ String(["canthisbe"]), String('canthisbeFOUND'.match(/[\x61-\x7A]+/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/ignoreCase.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/ignoreCase.js
new file mode 100644
index 0000000..fec4d2c
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/ignoreCase.js
@@ -0,0 +1,111 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: ignoreCase.js
+ Description: 'Tests RegExp attribute ignoreCase'
+
+ Author: Nick Lerissa
+ Date: March 13, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: ignoreCase';
+
+ writeHeaderToLog('Executing script: ignoreCase.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // /xyz/i.ignoreCase
+ testcases[count++] = new TestCase ( SECTION, "/xyz/i.ignoreCase",
+ true, /xyz/i.ignoreCase);
+
+ // /xyz/.ignoreCase
+ testcases[count++] = new TestCase ( SECTION, "/xyz/.ignoreCase",
+ false, /xyz/.ignoreCase);
+
+ // 'ABC def ghi'.match(/[a-z]+/ig)
+ testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(/[a-z]+/ig)",
+ String(["ABC","def","ghi"]), String('ABC def ghi'.match(/[a-z]+/ig)));
+
+ // 'ABC def ghi'.match(/[a-z]+/i)
+ testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(/[a-z]+/i)",
+ String(["ABC"]), String('ABC def ghi'.match(/[a-z]+/i)));
+
+ // 'ABC def ghi'.match(/([a-z]+)/ig)
+ testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(/([a-z]+)/ig)",
+ String(["ABC","def","ghi"]), String('ABC def ghi'.match(/([a-z]+)/ig)));
+
+ // 'ABC def ghi'.match(/([a-z]+)/i)
+ testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(/([a-z]+)/i)",
+ String(["ABC","ABC"]), String('ABC def ghi'.match(/([a-z]+)/i)));
+
+ // 'ABC def ghi'.match(/[a-z]+/)
+ testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(/[a-z]+/)",
+ String(["def"]), String('ABC def ghi'.match(/[a-z]+/)));
+
+ // (new RegExp('xyz','i')).ignoreCase
+ testcases[count++] = new TestCase ( SECTION, "(new RegExp('xyz','i')).ignoreCase",
+ true, (new RegExp('xyz','i')).ignoreCase);
+
+ // (new RegExp('xyz')).ignoreCase
+ testcases[count++] = new TestCase ( SECTION, "(new RegExp('xyz')).ignoreCase",
+ false, (new RegExp('xyz')).ignoreCase);
+
+ // 'ABC def ghi'.match(new RegExp('[a-z]+','ig'))
+ testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('[a-z]+','ig'))",
+ String(["ABC","def","ghi"]), String('ABC def ghi'.match(new RegExp('[a-z]+','ig'))));
+
+ // 'ABC def ghi'.match(new RegExp('[a-z]+','i'))
+ testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('[a-z]+','i'))",
+ String(["ABC"]), String('ABC def ghi'.match(new RegExp('[a-z]+','i'))));
+
+ // 'ABC def ghi'.match(new RegExp('([a-z]+)','ig'))
+ testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('([a-z]+)','ig'))",
+ String(["ABC","def","ghi"]), String('ABC def ghi'.match(new RegExp('([a-z]+)','ig'))));
+
+ // 'ABC def ghi'.match(new RegExp('([a-z]+)','i'))
+ testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('([a-z]+)','i'))",
+ String(["ABC","ABC"]), String('ABC def ghi'.match(new RegExp('([a-z]+)','i'))));
+
+ // 'ABC def ghi'.match(new RegExp('[a-z]+'))
+ testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('[a-z]+'))",
+ String(["def"]), String('ABC def ghi'.match(new RegExp('[a-z]+'))));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/interval.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/interval.js
new file mode 100644
index 0000000..7e80777
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/interval.js
@@ -0,0 +1,115 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: interval.js
+ Description: 'Tests regular expressions containing {}'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: {}';
+
+ writeHeaderToLog('Executing script: interval.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{2}c'))
+ testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{2}c'))",
+ String(["bbc"]), String('aaabbbbcccddeeeefffff'.match(new RegExp('b{2}c'))));
+
+ // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{8}'))
+ testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{8}'))",
+ null, 'aaabbbbcccddeeeefffff'.match(new RegExp('b{8}')));
+
+ // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{2,}c'))
+ testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{2,}c'))",
+ String(["bbbbc"]), String('aaabbbbcccddeeeefffff'.match(new RegExp('b{2,}c'))));
+
+ // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{8,}c'))
+ testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{8,}c'))",
+ null, 'aaabbbbcccddeeeefffff'.match(new RegExp('b{8,}c')));
+
+ // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{2,3}c'))
+ testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{2,3}c'))",
+ String(["bbbc"]), String('aaabbbbcccddeeeefffff'.match(new RegExp('b{2,3}c'))));
+
+ // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{42,93}c'))
+ testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{42,93}c'))",
+ null, 'aaabbbbcccddeeeefffff'.match(new RegExp('b{42,93}c')));
+
+ // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{0,93}c'))
+ testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{0,93}c'))",
+ String(["bbbbc"]), String('aaabbbbcccddeeeefffff'.match(new RegExp('b{0,93}c'))));
+
+ // 'aaabbbbcccddeeeefffff'.match(new RegExp('bx{0,93}c'))
+ testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('bx{0,93}c'))",
+ String(["bc"]), String('aaabbbbcccddeeeefffff'.match(new RegExp('bx{0,93}c'))));
+
+ // 'weirwerdf'.match(new RegExp('.{0,93}'))
+ testcases[count++] = new TestCase ( SECTION, "'weirwerdf'.match(new RegExp('.{0,93}'))",
+ String(["weirwerdf"]), String('weirwerdf'.match(new RegExp('.{0,93}'))));
+
+ // 'wqe456646dsff'.match(new RegExp('\d{1,}'))
+ testcases[count++] = new TestCase ( SECTION, "'wqe456646dsff'.match(new RegExp('\\d{1,}'))",
+ String(["456646"]), String('wqe456646dsff'.match(new RegExp('\\d{1,}'))));
+
+ // '123123'.match(new RegExp('(123){1,}'))
+ testcases[count++] = new TestCase ( SECTION, "'123123'.match(new RegExp('(123){1,}'))",
+ String(["123123","123"]), String('123123'.match(new RegExp('(123){1,}'))));
+
+ // '123123x123'.match(new RegExp('(123){1,}x\1'))
+ testcases[count++] = new TestCase ( SECTION, "'123123x123'.match(new RegExp('(123){1,}x\\1'))",
+ String(["123123x123","123"]), String('123123x123'.match(new RegExp('(123){1,}x\\1'))));
+
+ // '123123x123'.match(/(123){1,}x\1/)
+ testcases[count++] = new TestCase ( SECTION, "'123123x123'.match(/(123){1,}x\\1/)",
+ String(["123123x123","123"]), String('123123x123'.match(/(123){1,}x\1/)));
+
+ // 'xxxxxxx'.match(new RegExp('x{1,2}x{1,}'))
+ testcases[count++] = new TestCase ( SECTION, "'xxxxxxx'.match(new RegExp('x{1,2}x{1,}'))",
+ String(["xxxxxxx"]), String('xxxxxxx'.match(new RegExp('x{1,2}x{1,}'))));
+
+ // 'xxxxxxx'.match(/x{1,2}x{1,}/)
+ testcases[count++] = new TestCase ( SECTION, "'xxxxxxx'.match(/x{1,2}x{1,}/)",
+ String(["xxxxxxx"]), String('xxxxxxx'.match(/x{1,2}x{1,}/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/octal.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/octal.js
new file mode 100644
index 0000000..2fe6588
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/octal.js
@@ -0,0 +1,108 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: octal.js
+ Description: 'Tests regular expressions containing \<number> '
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: \# (octal) ';
+
+ writeHeaderToLog('Executing script: octal.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ var testPattern = '\\101\\102\\103\\104\\105\\106\\107\\110\\111\\112\\113\\114\\115\\116\\117\\120\\121\\122\\123\\124\\125\\126\\127\\130\\131\\132';
+
+ var testString = "12345ABCDEFGHIJKLMNOPQRSTUVWXYZ67890";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
+ String(["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]), String(testString.match(new RegExp(testPattern))));
+
+ testPattern = '\\141\\142\\143\\144\\145\\146\\147\\150\\151\\152\\153\\154\\155\\156\\157\\160\\161\\162\\163\\164\\165\\166\\167\\170\\171\\172';
+
+ testString = "12345AabcdefghijklmnopqrstuvwxyzZ67890";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
+ String(["abcdefghijklmnopqrstuvwxyz"]), String(testString.match(new RegExp(testPattern))));
+
+ testPattern = '\\40\\41\\42\\43\\44\\45\\46\\47\\50\\51\\52\\53\\54\\55\\56\\57\\60\\61\\62\\63';
+
+ testString = "abc !\"#$%&'()*+,-./0123ZBC";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
+ String([" !\"#$%&'()*+,-./0123"]), String(testString.match(new RegExp(testPattern))));
+
+ testPattern = '\\64\\65\\66\\67\\70\\71\\72\\73\\74\\75\\76\\77\\100';
+
+ testString = "123456789:;<=>?@ABC";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
+ String(["456789:;<=>?@"]), String(testString.match(new RegExp(testPattern))));
+
+ testPattern = '\\173\\174\\175\\176';
+
+ testString = "1234{|}~ABC";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
+ String(["{|}~"]), String(testString.match(new RegExp(testPattern))));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'canthisbeFOUND'.match(new RegExp('[A-\\132]+'))",
+ String(["FOUND"]), String('canthisbeFOUND'.match(new RegExp('[A-\\132]+'))));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'canthisbeFOUND'.match(new RegExp('[\\141-\\172]+'))",
+ String(["canthisbe"]), String('canthisbeFOUND'.match(new RegExp('[\\141-\\172]+'))));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'canthisbeFOUND'.match(/[\\141-\\172]+/)",
+ String(["canthisbe"]), String('canthisbeFOUND'.match(/[\141-\172]+/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/parentheses.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/parentheses.js
new file mode 100644
index 0000000..6fe1948
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/parentheses.js
@@ -0,0 +1,107 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: parentheses.js
+ Description: 'Tests regular expressions containing ()'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: ()';
+
+ writeHeaderToLog('Executing script: parentheses.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abc'.match(new RegExp('(abc)'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('(abc)'))",
+ String(["abc","abc"]), String('abc'.match(new RegExp('(abc)'))));
+
+ // 'abcdefg'.match(new RegExp('a(bc)d(ef)g'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('a(bc)d(ef)g'))",
+ String(["abcdefg","bc","ef"]), String('abcdefg'.match(new RegExp('a(bc)d(ef)g'))));
+
+ // 'abcdefg'.match(new RegExp('(.{3})(.{4})'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(.{3})(.{4})'))",
+ String(["abcdefg","abc","defg"]), String('abcdefg'.match(new RegExp('(.{3})(.{4})'))));
+
+ // 'aabcdaabcd'.match(new RegExp('(aa)bcd\1'))
+ testcases[count++] = new TestCase ( SECTION, "'aabcdaabcd'.match(new RegExp('(aa)bcd\\1'))",
+ String(["aabcdaa","aa"]), String('aabcdaabcd'.match(new RegExp('(aa)bcd\\1'))));
+
+ // 'aabcdaabcd'.match(new RegExp('(aa).+\1'))
+ testcases[count++] = new TestCase ( SECTION, "'aabcdaabcd'.match(new RegExp('(aa).+\\1'))",
+ String(["aabcdaa","aa"]), String('aabcdaabcd'.match(new RegExp('(aa).+\\1'))));
+
+ // 'aabcdaabcd'.match(new RegExp('(.{2}).+\1'))
+ testcases[count++] = new TestCase ( SECTION, "'aabcdaabcd'.match(new RegExp('(.{2}).+\\1'))",
+ String(["aabcdaa","aa"]), String('aabcdaabcd'.match(new RegExp('(.{2}).+\\1'))));
+
+ // '123456123456'.match(new RegExp('(\d{3})(\d{3})\1\2'))
+ testcases[count++] = new TestCase ( SECTION, "'123456123456'.match(new RegExp('(\\d{3})(\\d{3})\\1\\2'))",
+ String(["123456123456","123","456"]), String('123456123456'.match(new RegExp('(\\d{3})(\\d{3})\\1\\2'))));
+
+ // 'abcdefg'.match(new RegExp('a(..(..)..)'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('a(..(..)..)'))",
+ String(["abcdefg","bcdefg","de"]), String('abcdefg'.match(new RegExp('a(..(..)..)'))));
+
+ // 'abcdefg'.match(/a(..(..)..)/)
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/a(..(..)..)/)",
+ String(["abcdefg","bcdefg","de"]), String('abcdefg'.match(/a(..(..)..)/)));
+
+ // 'xabcdefg'.match(new RegExp('(a(b(c)))(d(e(f)))'))
+ testcases[count++] = new TestCase ( SECTION, "'xabcdefg'.match(new RegExp('(a(b(c)))(d(e(f)))'))",
+ String(["abcdef","abc","bc","c","def","ef","f"]), String('xabcdefg'.match(new RegExp('(a(b(c)))(d(e(f)))'))));
+
+ // 'xabcdefbcefg'.match(new RegExp('(a(b(c)))(d(e(f)))\2\5'))
+ testcases[count++] = new TestCase ( SECTION, "'xabcdefbcefg'.match(new RegExp('(a(b(c)))(d(e(f)))\\2\\5'))",
+ String(["abcdefbcef","abc","bc","c","def","ef","f"]), String('xabcdefbcefg'.match(new RegExp('(a(b(c)))(d(e(f)))\\2\\5'))));
+
+ // 'abcd'.match(new RegExp('a(.?)b\1c\1d\1'))
+ testcases[count++] = new TestCase ( SECTION, "'abcd'.match(new RegExp('a(.?)b\\1c\\1d\\1'))",
+ String(["abcd",""]), String('abcd'.match(new RegExp('a(.?)b\\1c\\1d\\1'))));
+
+ // 'abcd'.match(/a(.?)b\1c\1d\1/)
+ testcases[count++] = new TestCase ( SECTION, "'abcd'.match(/a(.?)b\\1c\\1d\\1/)",
+ String(["abcd",""]), String('abcd'.match(/a(.?)b\1c\1d\1/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/plus.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/plus.js
new file mode 100644
index 0000000..f3e44ea
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/plus.js
@@ -0,0 +1,87 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: plus.js
+ Description: 'Tests regular expressions containing +'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: +';
+
+ writeHeaderToLog('Executing script: plus.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcdddddefg'.match(new RegExp('d+'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdddddefg'.match(new RegExp('d+'))",
+ String(["ddddd"]), String('abcdddddefg'.match(new RegExp('d+'))));
+
+ // 'abcdefg'.match(new RegExp('o+'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('o+'))",
+ null, 'abcdefg'.match(new RegExp('o+')));
+
+ // 'abcdefg'.match(new RegExp('d+'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('d+'))",
+ String(['d']), String('abcdefg'.match(new RegExp('d+'))));
+
+ // 'abbbbbbbc'.match(new RegExp('(b+)(b+)(b+)'))
+ testcases[count++] = new TestCase ( SECTION, "'abbbbbbbc'.match(new RegExp('(b+)(b+)(b+)'))",
+ String(["bbbbbbb","bbbbb","b","b"]), String('abbbbbbbc'.match(new RegExp('(b+)(b+)(b+)'))));
+
+ // 'abbbbbbbc'.match(new RegExp('(b+)(b*)'))
+ testcases[count++] = new TestCase ( SECTION, "'abbbbbbbc'.match(new RegExp('(b+)(b*)'))",
+ String(["bbbbbbb","bbbbbbb",""]), String('abbbbbbbc'.match(new RegExp('(b+)(b*)'))));
+
+ // 'abbbbbbbc'.match(new RegExp('b*b+'))
+ testcases[count++] = new TestCase ( SECTION, "'abbbbbbbc'.match(new RegExp('b*b+'))",
+ String(['bbbbbbb']), String('abbbbbbbc'.match(new RegExp('b*b+'))));
+
+ // 'abbbbbbbc'.match(/(b+)(b*)/)
+ testcases[count++] = new TestCase ( SECTION, "'abbbbbbbc'.match(/(b+)(b*)/)",
+ String(["bbbbbbb","bbbbbbb",""]), String('abbbbbbbc'.match(/(b+)(b*)/)));
+
+ // 'abbbbbbbc'.match(new RegExp('b*b+'))
+ testcases[count++] = new TestCase ( SECTION, "'abbbbbbbc'.match(/b*b+/)",
+ String(['bbbbbbb']), String('abbbbbbbc'.match(/b*b+/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/question_mark.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/question_mark.js
new file mode 100644
index 0000000..f17cd0b
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/question_mark.js
@@ -0,0 +1,99 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: question_mark.js
+ Description: 'Tests regular expressions containing ?'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: ?';
+
+ writeHeaderToLog('Executing script: question_mark.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcdef'.match(new RegExp('cd?e'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(new RegExp('cd?e'))",
+ String(["cde"]), String('abcdef'.match(new RegExp('cd?e'))));
+
+ // 'abcdef'.match(new RegExp('cdx?e'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(new RegExp('cdx?e'))",
+ String(["cde"]), String('abcdef'.match(new RegExp('cdx?e'))));
+
+ // 'pqrstuvw'.match(new RegExp('o?pqrst'))
+ testcases[count++] = new TestCase ( SECTION, "'pqrstuvw'.match(new RegExp('o?pqrst'))",
+ String(["pqrst"]), String('pqrstuvw'.match(new RegExp('o?pqrst'))));
+
+ // 'abcd'.match(new RegExp('x?y?z?'))
+ testcases[count++] = new TestCase ( SECTION, "'abcd'.match(new RegExp('x?y?z?'))",
+ String([""]), String('abcd'.match(new RegExp('x?y?z?'))));
+
+ // 'abcd'.match(new RegExp('x?ay?bz?c'))
+ testcases[count++] = new TestCase ( SECTION, "'abcd'.match(new RegExp('x?ay?bz?c'))",
+ String(["abc"]), String('abcd'.match(new RegExp('x?ay?bz?c'))));
+
+ // 'abcd'.match(/x?ay?bz?c/)
+ testcases[count++] = new TestCase ( SECTION, "'abcd'.match(/x?ay?bz?c/)",
+ String(["abc"]), String('abcd'.match(/x?ay?bz?c/)));
+
+ // 'abbbbc'.match(new RegExp('b?b?b?b'))
+ testcases[count++] = new TestCase ( SECTION, "'abbbbc'.match(new RegExp('b?b?b?b'))",
+ String(["bbbb"]), String('abbbbc'.match(new RegExp('b?b?b?b'))));
+
+ // '123az789'.match(new RegExp('ab?c?d?x?y?z'))
+ testcases[count++] = new TestCase ( SECTION, "'123az789'.match(new RegExp('ab?c?d?x?y?z'))",
+ String(["az"]), String('123az789'.match(new RegExp('ab?c?d?x?y?z'))));
+
+ // '123az789'.match(/ab?c?d?x?y?z/)
+ testcases[count++] = new TestCase ( SECTION, "'123az789'.match(/ab?c?d?x?y?z/)",
+ String(["az"]), String('123az789'.match(/ab?c?d?x?y?z/)));
+
+ // '?????'.match(new RegExp('\\??\\??\\??\\??\\??'))
+ testcases[count++] = new TestCase ( SECTION, "'?????'.match(new RegExp('\\??\\??\\??\\??\\??'))",
+ String(["?????"]), String('?????'.match(new RegExp('\\??\\??\\??\\??\\??'))));
+
+ // 'test'.match(new RegExp('.?.?.?.?.?.?.?'))
+ testcases[count++] = new TestCase ( SECTION, "'test'.match(new RegExp('.?.?.?.?.?.?.?'))",
+ String(["test"]), String('test'.match(new RegExp('.?.?.?.?.?.?.?'))));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/regress-6359.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/regress-6359.js
new file mode 100644
index 0000000..20ac50f
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/regress-6359.js
@@ -0,0 +1,68 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s):
+*/
+
+/**
+ * File Name: regress-6359.js
+ * Reference: ** replace with bugzilla URL or document reference **
+ * Description: ** replace with description of test **
+ * Author: ** replace with your e-mail address **
+ */
+
+ var SECTION = "js1_2"; // provide a document reference (ie, ECMA section)
+ var VERSION = "ECMA_2"; // Version of JavaScript or ECMA
+ var TITLE = "Regression test for bugzilla # 6359"; // Provide ECMA section title or a description
+ var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=6359"; // Provide URL to bugsplat or bugzilla report
+
+ startTest(); // leave this alone
+
+ /*
+ * Calls to AddTestCase here. AddTestCase is a function that is defined
+ * in shell.js and takes three arguments:
+ * - a string representation of what is being tested
+ * - the expected result
+ * - the actual result
+ *
+ * For example, a test might look like this:
+ *
+ * var zip = /[\d]{5}$/;
+ *
+ * AddTestCase(
+ * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test
+ * "02134", // expected result
+ * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result
+ *
+ */
+
+ AddTestCase( '/(a*)b\1+/("baaac").length',
+ 2,
+ /(a*)b\1+/("baaac").length );
+
+ AddTestCase( '/(a*)b\1+/("baaac")[0]',
+ "b",
+ /(a*)b\1+/("baaac")[0]);
+
+ AddTestCase( '/(a*)b\1+/("baaac")[1]',
+ "",
+ /(a*)b\1+/("baaac")[1]);
+
+
+ test(); // leave this alone. this executes the test cases and
+ // displays results.
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/regress-9141.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/regress-9141.js
new file mode 100644
index 0000000..3601bcf
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/regress-9141.js
@@ -0,0 +1,86 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s):
+*/
+
+/**
+ * File Name: regress-9141.js
+ * Reference: "http://bugzilla.mozilla.org/show_bug.cgi?id=9141";
+ * Description:
+ * From waldemar@netscape.com:
+ *
+ * The following page crashes the system:
+ *
+ * <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
+ * "http://www.w3.org/TR/REC-html40/loose.dtd">
+ * <HTML>
+ * <HEAD>
+ * </HEAD>
+ * <BODY>
+ * <SCRIPT type="text/javascript">
+ * var s = "x";
+ * for (var i = 0; i != 13; i++) s += s;
+ * var a = /(?:xx|x)*[slash](s);
+ * var b = /(xx|x)*[slash](s);
+ * document.write("Results = " + a.length + "," + b.length);
+ * </SCRIPT>
+ * </BODY>
+ */
+
+ var SECTION = "js1_2"; // provide a document reference (ie, ECMA section)
+ var VERSION = "ECMA_2"; // Version of JavaScript or ECMA
+ var TITLE = "Regression test for bugzilla # 9141"; // Provide ECMA section title or a description
+ var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=9141"; // Provide URL to bugsplat or bugzilla report
+
+ startTest(); // leave this alone
+
+ /*
+ * Calls to AddTestCase here. AddTestCase is a function that is defined
+ * in shell.js and takes three arguments:
+ * - a string representation of what is being tested
+ * - the expected result
+ * - the actual result
+ *
+ * For example, a test might look like this:
+ *
+ * var zip = /[\d]{5}$/;
+ *
+ * AddTestCase(
+ * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test
+ * "02134", // expected result
+ * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result
+ *
+ */
+
+ var s = "x";
+ for (var i = 0; i != 13; i++) s += s;
+ var a = /(?:xx|x)*/(s);
+ var b = /(xx|x)*/(s);
+
+ AddTestCase( "var s = 'x'; for (var i = 0; i != 13; i++) s += s; " +
+ "a = /(?:xx|x)*/(s); a.length",
+ 1,
+ a.length );
+
+ AddTestCase( "var b = /(xx|x)*/(s); b.length",
+ 2,
+ b.length );
+
+ test(); // leave this alone. this executes the test cases and
+ // displays results.
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/simple_form.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/simple_form.js
new file mode 100644
index 0000000..e369c3e
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/simple_form.js
@@ -0,0 +1,90 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: simple_form.js
+ Description: 'Tests regular expressions using simple form: re(...)'
+
+ Author: Nick Lerissa
+ Date: March 19, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: simple form';
+
+ writeHeaderToLog('Executing script: simple_form.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ testcases[count++] = new TestCase ( SECTION,
+ "/[0-9]{3}/('23 2 34 678 9 09')",
+ String(["678"]), String(/[0-9]{3}/('23 2 34 678 9 09')));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "/3.{4}8/('23 2 34 678 9 09')",
+ String(["34 678"]), String(/3.{4}8/('23 2 34 678 9 09')));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "(/3.{4}8/('23 2 34 678 9 09').length",
+ 1, (/3.{4}8/('23 2 34 678 9 09')).length);
+
+ var re = /[0-9]{3}/;
+ testcases[count++] = new TestCase ( SECTION,
+ "re('23 2 34 678 9 09')",
+ String(["678"]), String(re('23 2 34 678 9 09')));
+
+ re = /3.{4}8/;
+ testcases[count++] = new TestCase ( SECTION,
+ "re('23 2 34 678 9 09')",
+ String(["34 678"]), String(re('23 2 34 678 9 09')));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "/3.{4}8/('23 2 34 678 9 09')",
+ String(["34 678"]), String(/3.{4}8/('23 2 34 678 9 09')));
+
+ re =/3.{4}8/;
+ testcases[count++] = new TestCase ( SECTION,
+ "(re('23 2 34 678 9 09').length",
+ 1, (re('23 2 34 678 9 09')).length);
+
+ testcases[count++] = new TestCase ( SECTION,
+ "(/3.{4}8/('23 2 34 678 9 09').length",
+ 1, (/3.{4}8/('23 2 34 678 9 09')).length);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/source.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/source.js
new file mode 100644
index 0000000..589d2b9
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/source.js
@@ -0,0 +1,87 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: source.js
+ Description: 'Tests RegExp attribute source'
+
+ Author: Nick Lerissa
+ Date: March 13, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: source';
+
+ writeHeaderToLog('Executing script: source.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // /xyz/g.source
+ testcases[count++] = new TestCase ( SECTION, "/xyz/g.source",
+ "xyz", /xyz/g.source);
+
+ // /xyz/.source
+ testcases[count++] = new TestCase ( SECTION, "/xyz/.source",
+ "xyz", /xyz/.source);
+
+ // /abc\\def/.source
+ testcases[count++] = new TestCase ( SECTION, "/abc\\\\def/.source",
+ "abc\\\\def", /abc\\def/.source);
+
+ // /abc[\b]def/.source
+ testcases[count++] = new TestCase ( SECTION, "/abc[\\b]def/.source",
+ "abc[\\b]def", /abc[\b]def/.source);
+
+ // (new RegExp('xyz')).source
+ testcases[count++] = new TestCase ( SECTION, "(new RegExp('xyz')).source",
+ "xyz", (new RegExp('xyz')).source);
+
+ // (new RegExp('xyz','g')).source
+ testcases[count++] = new TestCase ( SECTION, "(new RegExp('xyz','g')).source",
+ "xyz", (new RegExp('xyz','g')).source);
+
+ // (new RegExp('abc\\\\def')).source
+ testcases[count++] = new TestCase ( SECTION, "(new RegExp('abc\\\\\\\\def')).source",
+ "abc\\\\def", (new RegExp('abc\\\\def')).source);
+
+ // (new RegExp('abc[\\b]def')).source
+ testcases[count++] = new TestCase ( SECTION, "(new RegExp('abc[\\\\b]def')).source",
+ "abc[\\b]def", (new RegExp('abc[\\b]def')).source);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/special_characters.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/special_characters.js
new file mode 100644
index 0000000..8675980
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/special_characters.js
@@ -0,0 +1,157 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: special_characters.js
+ Description: 'Tests regular expressions containing special characters'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: special_charaters';
+
+ writeHeaderToLog('Executing script: special_characters.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // testing backslash '\'
+ testcases[count++] = new TestCase ( SECTION, "'^abcdefghi'.match(/\^abc/)", String(["^abc"]), String('^abcdefghi'.match(/\^abc/)));
+
+ // testing beginning of line '^'
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/^abc/)", String(["abc"]), String('abcdefghi'.match(/^abc/)));
+
+ // testing end of line '$'
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/fghi$/)", String(["ghi"]), String('abcdefghi'.match(/ghi$/)));
+
+ // testing repeat '*'
+ testcases[count++] = new TestCase ( SECTION, "'eeeefghi'.match(/e*/)", String(["eeee"]), String('eeeefghi'.match(/e*/)));
+
+ // testing repeat 1 or more times '+'
+ testcases[count++] = new TestCase ( SECTION, "'abcdeeeefghi'.match(/e+/)", String(["eeee"]), String('abcdeeeefghi'.match(/e+/)));
+
+ // testing repeat 0 or 1 time '?'
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/abc?de/)", String(["abcde"]), String('abcdefghi'.match(/abc?de/)));
+
+ // testing any character '.'
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/c.e/)", String(["cde"]), String('abcdefghi'.match(/c.e/)));
+
+ // testing remembering ()
+ testcases[count++] = new TestCase ( SECTION, "'abcewirjskjdabciewjsdf'.match(/(abc).+\\1'/)",
+ String(["abcewirjskjdabc","abc"]), String('abcewirjskjdabciewjsdf'.match(/(abc).+\1/)));
+
+ // testing or match '|'
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/xyz|def/)", String(["def"]), String('abcdefghi'.match(/xyz|def/)));
+
+ // testing repeat n {n}
+ testcases[count++] = new TestCase ( SECTION, "'abcdeeeefghi'.match(/e{3}/)", String(["eee"]), String('abcdeeeefghi'.match(/e{3}/)));
+
+ // testing min repeat n {n,}
+ testcases[count++] = new TestCase ( SECTION, "'abcdeeeefghi'.match(/e{3,}/)", String(["eeee"]), String('abcdeeeefghi'.match(/e{3,}/)));
+
+ // testing min/max repeat {min, max}
+ testcases[count++] = new TestCase ( SECTION, "'abcdeeeefghi'.match(/e{2,8}/)", String(["eeee"]), String('abcdeeeefghi'.match(/e{2,8}/)));
+
+ // testing any in set [abc...]
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/cd[xey]fgh/)", String(["cdefgh"]), String('abcdefghi'.match(/cd[xey]fgh/)));
+
+ // testing any in set [a-z]
+ testcases[count++] = new TestCase ( SECTION, "'netscape inc'.match(/t[r-v]ca/)", String(["tsca"]), String('netscape inc'.match(/t[r-v]ca/)));
+
+ // testing any not in set [^abc...]
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/cd[^xy]fgh/)", String(["cdefgh"]), String('abcdefghi'.match(/cd[^xy]fgh/)));
+
+ // testing any not in set [^a-z]
+ testcases[count++] = new TestCase ( SECTION, "'netscape inc'.match(/t[^a-c]ca/)", String(["tsca"]), String('netscape inc'.match(/t[^a-c]ca/)));
+
+ // testing backspace [\b]
+ testcases[count++] = new TestCase ( SECTION, "'this is b\ba test'.match(/is b[\b]a test/)",
+ String(["is b\ba test"]), String('this is b\ba test'.match(/is b[\b]a test/)));
+
+ // testing word boundary \b
+ testcases[count++] = new TestCase ( SECTION, "'today is now - day is not now'.match(/\bday.*now/)",
+ String(["day is not now"]), String('today is now - day is not now'.match(/\bday.*now/)));
+
+ // control characters???
+
+ // testing any digit \d
+ testcases[count++] = new TestCase ( SECTION, "'a dog - 1 dog'.match(/\d dog/)", String(["1 dog"]), String('a dog - 1 dog'.match(/\d dog/)));
+
+ // testing any non digit \d
+ testcases[count++] = new TestCase ( SECTION, "'a dog - 1 dog'.match(/\D dog/)", String(["a dog"]), String('a dog - 1 dog'.match(/\D dog/)));
+
+ // testing form feed '\f'
+ testcases[count++] = new TestCase ( SECTION, "'a b a\fb'.match(/a\fb/)", String(["a\fb"]), String('a b a\fb'.match(/a\fb/)));
+
+ // testing line feed '\n'
+ testcases[count++] = new TestCase ( SECTION, "'a b a\nb'.match(/a\nb/)", String(["a\nb"]), String('a b a\nb'.match(/a\nb/)));
+
+ // testing carriage return '\r'
+ testcases[count++] = new TestCase ( SECTION, "'a b a\rb'.match(/a\rb/)", String(["a\rb"]), String('a b a\rb'.match(/a\rb/)));
+
+ // testing whitespace '\s'
+ testcases[count++] = new TestCase ( SECTION, "'xa\f\n\r\t\vbz'.match(/a\s+b/)", String(["a\f\n\r\t\vb"]), String('xa\f\n\r\t\vbz'.match(/a\s+b/)));
+
+ // testing non whitespace '\S'
+ testcases[count++] = new TestCase ( SECTION, "'a\tb a b a-b'.match(/a\Sb/)", String(["a-b"]), String('a\tb a b a-b'.match(/a\Sb/)));
+
+ // testing tab '\t'
+ testcases[count++] = new TestCase ( SECTION, "'a\t\tb a b'.match(/a\t{2}/)", String(["a\t\t"]), String('a\t\tb a b'.match(/a\t{2}/)));
+
+ // testing vertical tab '\v'
+ testcases[count++] = new TestCase ( SECTION, "'a\v\vb a b'.match(/a\v{2}/)", String(["a\v\v"]), String('a\v\vb a b'.match(/a\v{2}/)));
+
+ // testing alphnumeric characters '\w'
+ testcases[count++] = new TestCase ( SECTION, "'%AZaz09_$'.match(/\w+/)", String(["AZaz09_"]), String('%AZaz09_$'.match(/\w+/)));
+
+ // testing non alphnumeric characters '\W'
+ testcases[count++] = new TestCase ( SECTION, "'azx$%#@*4534'.match(/\W+/)", String(["$%#@*"]), String('azx$%#@*4534'.match(/\W+/)));
+
+ // testing back references '\<number>'
+ testcases[count++] = new TestCase ( SECTION, "'test'.match(/(t)es\\1/)", String(["test","t"]), String('test'.match(/(t)es\1/)));
+
+ // testing hex excaping with '\'
+ testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(/\x63\x64/)", String(["cd"]), String('abcdef'.match(/\x63\x64/)));
+
+ // testing oct excaping with '\'
+ testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(/\\143\\144/)", String(["cd"]), String('abcdef'.match(/\143\144/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/string_replace.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/string_replace.js
new file mode 100644
index 0000000..b95ddf3
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/string_replace.js
@@ -0,0 +1,80 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: string_replace.js
+ Description: 'Tests the replace method on Strings using regular expressions'
+
+ Author: Nick Lerissa
+ Date: March 11, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String: replace';
+
+ writeHeaderToLog('Executing script: string_replace.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'adddb'.replace(/ddd/,"XX")
+ testcases[count++] = new TestCase ( SECTION, "'adddb'.replace(/ddd/,'XX')",
+ "aXXb", 'adddb'.replace(/ddd/,'XX'));
+
+ // 'adddb'.replace(/eee/,"XX")
+ testcases[count++] = new TestCase ( SECTION, "'adddb'.replace(/eee/,'XX')",
+ 'adddb', 'adddb'.replace(/eee/,'XX'));
+
+ // '34 56 78b 12'.replace(new RegExp('[0-9]+b'),'**')
+ testcases[count++] = new TestCase ( SECTION, "'34 56 78b 12'.replace(new RegExp('[0-9]+b'),'**')",
+ "34 56 ** 12", '34 56 78b 12'.replace(new RegExp('[0-9]+b'),'**'));
+
+ // '34 56 78b 12'.replace(new RegExp('[0-9]+c'),'XX')
+ testcases[count++] = new TestCase ( SECTION, "'34 56 78b 12'.replace(new RegExp('[0-9]+c'),'XX')",
+ "34 56 78b 12", '34 56 78b 12'.replace(new RegExp('[0-9]+c'),'XX'));
+
+ // 'original'.replace(new RegExp(),'XX')
+ testcases[count++] = new TestCase ( SECTION, "'original'.replace(new RegExp(),'XX')",
+ "XXoriginal", 'original'.replace(new RegExp(),'XX'));
+
+ // 'qwe ert x\t\n 345654AB'.replace(new RegExp('x\s*\d+(..)$'),'****')
+ testcases[count++] = new TestCase ( SECTION, "'qwe ert x\t\n 345654AB'.replace(new RegExp('x\\s*\\d+(..)$'),'****')",
+ "qwe ert ****", 'qwe ert x\t\n 345654AB'.replace(new RegExp('x\\s*\\d+(..)$'),'****'));
+
+
+function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/string_search.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/string_search.js
new file mode 100644
index 0000000..8d229c6
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/string_search.js
@@ -0,0 +1,87 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: string_search.js
+ Description: 'Tests the search method on Strings using regular expressions'
+
+ Author: Nick Lerissa
+ Date: March 12, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String: search';
+
+ writeHeaderToLog('Executing script: string_search.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcdefg'.search(/d/)
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.search(/d/)",
+ 3, 'abcdefg'.search(/d/));
+
+ // 'abcdefg'.search(/x/)
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.search(/x/)",
+ -1, 'abcdefg'.search(/x/));
+
+ // 'abcdefg123456hijklmn'.search(/\d+/)
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg123456hijklmn'.search(/\d+/)",
+ 7, 'abcdefg123456hijklmn'.search(/\d+/));
+
+ // 'abcdefg123456hijklmn'.search(new RegExp())
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg123456hijklmn'.search(new RegExp())",
+ 0, 'abcdefg123456hijklmn'.search(new RegExp()));
+
+ // 'abc'.search(new RegExp('$'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.search(new RegExp('$'))",
+ 3, 'abc'.search(new RegExp('$')));
+
+ // 'abc'.search(new RegExp('^'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.search(new RegExp('^'))",
+ 0, 'abc'.search(new RegExp('^')));
+
+ // 'abc1'.search(/.\d/)
+ testcases[count++] = new TestCase ( SECTION, "'abc1'.search(/.\d/)",
+ 2, 'abc1'.search(/.\d/));
+
+ // 'abc1'.search(/\d{2}/)
+ testcases[count++] = new TestCase ( SECTION, "'abc1'.search(/\d{2}/)",
+ -1, 'abc1'.search(/\d{2}/));
+
+function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/string_split.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/string_split.js
new file mode 100644
index 0000000..f824998
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/string_split.js
@@ -0,0 +1,91 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: string_split.js
+ Description: 'Tests the split method on Strings using regular expressions'
+
+ Author: Nick Lerissa
+ Date: March 11, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String: split';
+
+ writeHeaderToLog('Executing script: string_split.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'a b c de f'.split(/\s/)
+ testcases[count++] = new TestCase ( SECTION, "'a b c de f'.split(/\s/)",
+ String(["a","b","c","de","f"]), String('a b c de f'.split(/\s/)));
+
+ // 'a b c de f'.split(/\s/,3)
+ testcases[count++] = new TestCase ( SECTION, "'a b c de f'.split(/\s/,3)",
+ String(["a","b","c"]), String('a b c de f'.split(/\s/,3)));
+
+ // 'a b c de f'.split(/X/)
+ testcases[count++] = new TestCase ( SECTION, "'a b c de f'.split(/X/)",
+ String(["a b c de f"]), String('a b c de f'.split(/X/)));
+
+ // 'dfe23iu 34 =+65--'.split(/\d+/)
+ testcases[count++] = new TestCase ( SECTION, "'dfe23iu 34 =+65--'.split(/\d+/)",
+ String(["dfe","iu "," =+","--"]), String('dfe23iu 34 =+65--'.split(/\d+/)));
+
+ // 'dfe23iu 34 =+65--'.split(new RegExp('\d+'))
+ testcases[count++] = new TestCase ( SECTION, "'dfe23iu 34 =+65--'.split(new RegExp('\\d+'))",
+ String(["dfe","iu "," =+","--"]), String('dfe23iu 34 =+65--'.split(new RegExp('\\d+'))));
+
+ // 'abc'.split(/[a-z]/)
+ testcases[count++] = new TestCase ( SECTION, "'abc'.split(/[a-z]/)",
+ String(["","",""]), String('abc'.split(/[a-z]/)));
+
+ // 'abc'.split(/[a-z]/)
+ testcases[count++] = new TestCase ( SECTION, "'abc'.split(/[a-z]/)",
+ String(["","",""]), String('abc'.split(/[a-z]/)));
+
+ // 'abc'.split(new RegExp('[a-z]'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.split(new RegExp('[a-z]'))",
+ String(["","",""]), String('abc'.split(new RegExp('[a-z]'))));
+
+ // 'abc'.split(new RegExp('[a-z]'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.split(new RegExp('[a-z]'))",
+ String(["","",""]), String('abc'.split(new RegExp('[a-z]'))));
+
+function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/test.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/test.js
new file mode 100644
index 0000000..2325af1
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/test.js
@@ -0,0 +1,87 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: test.js
+ Description: 'Tests regular expressions method compile'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: test';
+
+ writeHeaderToLog('Executing script: test.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ testcases[count++] = new TestCase ( SECTION,
+ "/[0-9]{3}/.test('23 2 34 678 9 09')",
+ true, /[0-9]{3}/.test('23 2 34 678 9 09'));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "/[0-9]{3}/.test('23 2 34 78 9 09')",
+ false, /[0-9]{3}/.test('23 2 34 78 9 09'));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "/\w+ \w+ \w+/.test('do a test')",
+ true, /\w+ \w+ \w+/.test("do a test"));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "/\w+ \w+ \w+/.test('a test')",
+ false, /\w+ \w+ \w+/.test("a test"));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "(new RegExp('[0-9]{3}')).test('23 2 34 678 9 09')",
+ true, (new RegExp('[0-9]{3}')).test('23 2 34 678 9 09'));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "(new RegExp('[0-9]{3}')).test('23 2 34 78 9 09')",
+ false, (new RegExp('[0-9]{3}')).test('23 2 34 78 9 09'));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "(new RegExp('\\\\w+ \\\\w+ \\\\w+')).test('do a test')",
+ true, (new RegExp('\\w+ \\w+ \\w+')).test("do a test"));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "(new RegExp('\\\\w+ \\\\w+ \\\\w+')).test('a test')",
+ false, (new RegExp('\\w+ \\w+ \\w+')).test("a test"));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/toString.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/toString.js
new file mode 100644
index 0000000..554b934
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/toString.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: toString.js
+ Description: 'Tests RegExp method toString'
+
+ Author: Nick Lerissa
+ Date: March 13, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: toString';
+
+ writeHeaderToLog('Executing script: toString.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // var re = new RegExp(); re.toString()
+ var re = new RegExp();
+ testcases[count++] = new TestCase ( SECTION, "var re = new RegExp(); re.toString()",
+ '//', re.toString());
+
+ // re = /.+/; re.toString();
+ re = /.+/;
+ testcases[count++] = new TestCase ( SECTION, "re = /.+/; re.toString()",
+ '/.+/', re.toString());
+
+ // re = /test/gi; re.toString()
+ re = /test/gi;
+ testcases[count++] = new TestCase ( SECTION, "re = /test/gi; re.toString()",
+ '/test/gi', re.toString());
+
+ // re = /test2/ig; re.toString()
+ re = /test2/ig;
+ testcases[count++] = new TestCase ( SECTION, "re = /test2/ig; re.toString()",
+ '/test2/gi', re.toString());
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/vertical_bar.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/vertical_bar.js
new file mode 100644
index 0000000..39b428a
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/vertical_bar.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: vertical_bar.js
+ Description: 'Tests regular expressions containing |'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: |';
+
+ writeHeaderToLog('Executing script: vertical_bar.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abc'.match(new RegExp('xyz|abc'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('xyz|abc'))",
+ String(["abc"]), String('abc'.match(new RegExp('xyz|abc'))));
+
+ // 'this is a test'.match(new RegExp('quiz|exam|test|homework'))
+ testcases[count++] = new TestCase ( SECTION, "'this is a test'.match(new RegExp('quiz|exam|test|homework'))",
+ String(["test"]), String('this is a test'.match(new RegExp('quiz|exam|test|homework'))));
+
+ // 'abc'.match(new RegExp('xyz|...'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('xyz|...'))",
+ String(["abc"]), String('abc'.match(new RegExp('xyz|...'))));
+
+ // 'abc'.match(new RegExp('(.)..|abc'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('(.)..|abc'))",
+ String(["abc","a"]), String('abc'.match(new RegExp('(.)..|abc'))));
+
+ // 'color: grey'.match(new RegExp('.+: gr(a|e)y'))
+ testcases[count++] = new TestCase ( SECTION, "'color: grey'.match(new RegExp('.+: gr(a|e)y'))",
+ String(["color: grey","e"]), String('color: grey'.match(new RegExp('.+: gr(a|e)y'))));
+
+ // 'no match'.match(new RegExp('red|white|blue'))
+ testcases[count++] = new TestCase ( SECTION, "'no match'.match(new RegExp('red|white|blue'))",
+ null, 'no match'.match(new RegExp('red|white|blue')));
+
+ // 'Hi Bob'.match(new RegExp('(Rob)|(Bob)|(Robert)|(Bobby)'))
+ testcases[count++] = new TestCase ( SECTION, "'Hi Bob'.match(new RegExp('(Rob)|(Bob)|(Robert)|(Bobby)'))",
+ String(["Bob",undefined,"Bob", undefined, undefined]), String('Hi Bob'.match(new RegExp('(Rob)|(Bob)|(Robert)|(Bobby)'))));
+
+ // 'abcdef'.match(new RegExp('abc|bcd|cde|def'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(new RegExp('abc|bcd|cde|def'))",
+ String(["abc"]), String('abcdef'.match(new RegExp('abc|bcd|cde|def'))));
+
+ // 'Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/)
+ testcases[count++] = new TestCase ( SECTION, "'Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/)",
+ String(["Bob",undefined,"Bob", undefined, undefined]), String('Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/)));
+
+ // 'abcdef'.match(/abc|bcd|cde|def/)
+ testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(/abc|bcd|cde|def/)",
+ String(["abc"]), String('abcdef'.match(/abc|bcd|cde|def/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/whitespace.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/whitespace.js
new file mode 100644
index 0000000..40c78c3
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/whitespace.js
@@ -0,0 +1,122 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: whitespace.js
+ Description: 'Tests regular expressions containing \f\n\r\t\v\s\S\ '
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: \\f\\n\\r\\t\\v\\s\\S ';
+
+ writeHeaderToLog('Executing script: whitespace.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ var non_whitespace = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~`!@#$%^&*()-+={[}]|\\:;'<,>./?1234567890" + '"';
+ var whitespace = "\f\n\r\t\v ";
+
+ // be sure all whitespace is matched by \s
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + whitespace + "'.match(new RegExp('\\s+'))",
+ String([whitespace]), String(whitespace.match(new RegExp('\\s+'))));
+
+ // be sure all non-whitespace is matched by \S
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + non_whitespace + "'.match(new RegExp('\\S+'))",
+ String([non_whitespace]), String(non_whitespace.match(new RegExp('\\S+'))));
+
+ // be sure all non-whitespace is not matched by \s
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + non_whitespace + "'.match(new RegExp('\\s'))",
+ null, non_whitespace.match(new RegExp('\\s')));
+
+ // be sure all whitespace is not matched by \S
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + whitespace + "'.match(new RegExp('\\S'))",
+ null, whitespace.match(new RegExp('\\S')));
+
+ var s = non_whitespace + whitespace;
+
+ // be sure all digits are matched by \s
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\s+'))",
+ String([whitespace]), String(s.match(new RegExp('\\s+'))));
+
+ s = whitespace + non_whitespace;
+
+ // be sure all non-whitespace are matched by \S
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\S+'))",
+ String([non_whitespace]), String(s.match(new RegExp('\\S+'))));
+
+ // '1233345find me345'.match(new RegExp('[a-z\\s][a-z\\s]+'))
+ testcases[count++] = new TestCase ( SECTION, "'1233345find me345'.match(new RegExp('[a-z\\s][a-z\\s]+'))",
+ String(["find me"]), String('1233345find me345'.match(new RegExp('[a-z\\s][a-z\\s]+'))));
+
+ var i;
+
+ // be sure all whitespace characters match individually
+ for (i = 0; i < whitespace.length; ++i)
+ {
+ s = 'ab' + whitespace[i] + 'cd';
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\\\s'))",
+ String([whitespace[i]]), String(s.match(new RegExp('\\s'))));
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(/\s/)",
+ String([whitespace[i]]), String(s.match(/\s/)));
+ }
+ // be sure all non_whitespace characters match individually
+ for (i = 0; i < non_whitespace.length; ++i)
+ {
+ s = ' ' + non_whitespace[i] + ' ';
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\\\S'))",
+ String([non_whitespace[i]]), String(s.match(new RegExp('\\S'))));
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(/\S/)",
+ String([non_whitespace[i]]), String(s.match(/\S/)));
+ }
+
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regexp/word_boundary.js b/JavaScriptCore/tests/mozilla/js1_2/regexp/word_boundary.js
new file mode 100644
index 0000000..581499c
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regexp/word_boundary.js
@@ -0,0 +1,119 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: word_boundary.js
+ Description: 'Tests regular expressions containing \b and \B'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: \\b and \\B';
+
+ writeHeaderToLog('Executing script: word_boundary.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'cowboy boyish boy'.match(new RegExp('\bboy\b'))
+ testcases[count++] = new TestCase ( SECTION, "'cowboy boyish boy'.match(new RegExp('\\bboy\\b'))",
+ String(["boy"]), String('cowboy boyish boy'.match(new RegExp('\\bboy\\b'))));
+
+ var boundary_characters = "\f\n\r\t\v~`!@#$%^&*()-+={[}]|\\:;'<,>./? " + '"';
+ var non_boundary_characters = '1234567890_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ var s = '';
+ var i;
+
+ // testing whether all boundary characters are matched when they should be
+ for (i = 0; i < boundary_characters.length; ++i)
+ {
+ s = '123ab' + boundary_characters.charAt(i) + '123c' + boundary_characters.charAt(i);
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\b123[a-z]\\b'))",
+ String(["123c"]), String(s.match(new RegExp('\\b123[a-z]\\b'))));
+ }
+
+ // testing whether all non-boundary characters are matched when they should be
+ for (i = 0; i < non_boundary_characters.length; ++i)
+ {
+ s = '123ab' + non_boundary_characters.charAt(i) + '123c' + non_boundary_characters.charAt(i);
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\B123[a-z]\\B'))",
+ String(["123c"]), String(s.match(new RegExp('\\B123[a-z]\\B'))));
+ }
+
+ s = '';
+
+ // testing whether all boundary characters are not matched when they should not be
+ for (i = 0; i < boundary_characters.length; ++i)
+ {
+ s += boundary_characters[i] + "a" + i + "b";
+ }
+ s += "xa1111bx";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\Ba\\d+b\\B'))",
+ String(["a1111b"]), String(s.match(new RegExp('\\Ba\\d+b\\B'))));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(/\\Ba\\d+b\\B/)",
+ String(["a1111b"]), String(s.match(/\Ba\d+b\B/)));
+
+ s = '';
+
+ // testing whether all non-boundary characters are not matched when they should not be
+ for (i = 0; i < non_boundary_characters.length; ++i)
+ {
+ s += non_boundary_characters[i] + "a" + i + "b";
+ }
+ s += "(a1111b)";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\ba\\d+b\\b'))",
+ String(["a1111b"]), String(s.match(new RegExp('\\ba\\d+b\\b'))));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(/\\ba\\d+b\\b/)",
+ String(["a1111b"]), String(s.match(/\ba\d+b\b/)));
+
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regress/regress-144834.js b/JavaScriptCore/tests/mozilla/js1_2/regress/regress-144834.js
new file mode 100644
index 0000000..cfbfc1b
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regress/regress-144834.js
@@ -0,0 +1,76 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): bzbarsky@mit.edu, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 05 July 2002
+* SUMMARY: Testing local var having same name as switch label inside function
+*
+* The code below crashed while compiling in JS1.1 or JS1.2
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=144834
+*
+*/
+//-----------------------------------------------------------------------------
+var bug = 144834;
+var summary = 'Local var having same name as switch label inside function';
+
+print(bug);
+print(summary);
+
+
+function RedrawSched()
+{
+ var MinBound;
+
+ switch (i)
+ {
+ case MinBound :
+ }
+}
+
+
+/*
+ * Also try eval scope -
+ */
+var s = '';
+s += 'function RedrawSched()';
+s += '{';
+s += ' var MinBound;';
+s += '';
+s += ' switch (i)';
+s += ' {';
+s += ' case MinBound :';
+s += ' }';
+s += '}';
+eval(s);
diff --git a/JavaScriptCore/tests/mozilla/js1_2/regress/regress-7703.js b/JavaScriptCore/tests/mozilla/js1_2/regress/regress-7703.js
new file mode 100644
index 0000000..7808d9b
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/regress/regress-7703.js
@@ -0,0 +1,83 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s):
+*/
+
+/**
+ * File Name: regress-7703.js
+ * Reference: "http://bugzilla.mozilla.org/show_bug.cgi?id=7703";
+ * Description: See the text of the bugnumber above
+ */
+
+ var SECTION = "js1_2"; // provide a document reference (ie, ECMA section)
+ var VERSION = "JS1_2"; // Version of JavaScript or ECMA
+ var TITLE = "Regression test for bugzilla # 7703"; // Provide ECMA section title or a description
+ var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=7703"; // Provide URL to bugsplat or bugzilla report
+
+ startTest(); // leave this alone
+
+ /*
+ * Calls to AddTestCase here. AddTestCase is a function that is defined
+ * in shell.js and takes three arguments:
+ * - a string representation of what is being tested
+ * - the expected result
+ * - the actual result
+ *
+ * For example, a test might look like this:
+ *
+ * var zip = /[\d]{5}$/;
+ *
+ * AddTestCase(
+ * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test
+ * "02134", // expected result
+ * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result
+ *
+ */
+
+ types = [];
+ function inspect(object) {
+ for (prop in object) {
+ var x = object[prop];
+ types[types.length] = (typeof x);
+ }
+ }
+
+ var o = {a: 1, b: 2};
+ inspect(o);
+
+ AddTestCase( "inspect(o),length", 2, types.length );
+ AddTestCase( "inspect(o)[0]", "number", types[0] );
+ AddTestCase( "inspect(o)[1]", "number", types[1] );
+
+ types_2 = [];
+
+ function inspect_again(object) {
+ for (prop in object) {
+ types_2[types_2.length] = (typeof object[prop]);
+ }
+ }
+
+ inspect_again(o);
+ AddTestCase( "inspect_again(o),length", 2, types.length );
+ AddTestCase( "inspect_again(o)[0]", "number", types[0] );
+ AddTestCase( "inspect_again(o)[1]", "number", types[1] );
+
+
+ test(); // leave this alone. this executes the test cases and
+ // displays results.
diff --git a/JavaScriptCore/tests/mozilla/js1_2/shell.js b/JavaScriptCore/tests/mozilla/js1_2/shell.js
new file mode 100644
index 0000000..ba57d61
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/shell.js
@@ -0,0 +1,147 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+var completed = false;
+var testcases;
+
+var SECTION = "";
+var VERSION = "";
+var BUGNUMBER = "";
+
+var GLOBAL = "[object global]";
+var PASSED = " PASSED!"
+var FAILED = " FAILED! expected: ";
+
+startTest();
+
+ version(120);
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+/* wrapper for test cas constructor that doesn't require the SECTION
+ * argument.
+ */
+
+function AddTestCase( description, expect, actual ) {
+ testcases[tc++] = new TestCase( SECTION, description, expect, actual );
+}
+
+
+function TestCase( n, d, e, a ) {
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+
+ this.passed = getTestCaseResult( this.expect, this.actual );
+}
+function startTest() {
+ version(120);
+
+ if ( BUGNUMBER ) {
+ writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ }
+
+ testcases = new Array();
+ tc = 0;
+}
+function getTestCaseResult( expect, actual ) {
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual ) {
+ if ( typeof actual == "object" ) {
+ actual = "NaN object";
+ } else {
+ actual = "NaN number";
+ }
+ }
+ if ( expect != expect ) {
+ if ( typeof expect == "object" ) {
+ expect = "NaN object";
+ } else {
+ expect = "NaN number";
+ }
+ }
+
+ var passed = ( expect == actual ) ? true : false;
+
+ // if both objects are numbers, give a little leeway for rounding.
+ if ( !passed
+ && typeof(actual) == "number"
+ && typeof(expect) == "number"
+ ) {
+ if ( Math.abs(actual-expect) < 0.0000001 ) {
+ passed = true;
+ }
+ }
+
+ // verify type is the same
+ if ( typeof(expect) != typeof(actual) ) {
+ passed = false;
+ }
+
+ return passed;
+}
+/*
+ * Begin printing functions. These functions use the shell's
+ * print function. When running tests in the browser, these
+ * functions, override these functions with functions that use
+ * document.write.
+ */
+
+function writeTestCaseResult( expect, actual, string ) {
+ var passed = getTestCaseResult( expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = string ;
+ s += ( passed ) ? PASSED : FAILED + expect;
+ writeLineToLog( s);
+ return passed;
+}
+function writeLineToLog( string ) {
+ print( string );
+}
+function writeHeaderToLog( string ) {
+ print( string );
+}
+/* end of print functions */
+
+function stopTest() {
+ var gc;
+ if ( gc != undefined ) {
+ gc();
+ }
+}
diff --git a/JavaScriptCore/tests/mozilla/js1_2/statements/break.js b/JavaScriptCore/tests/mozilla/js1_2/statements/break.js
new file mode 100644
index 0000000..ffe177d
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/statements/break.js
@@ -0,0 +1,162 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: break.js
+ Description: 'Tests the break statement'
+
+ Author: Nick Lerissa
+ Date: March 18, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'statements: break';
+
+ writeHeaderToLog("Executing script: break.js");
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ var i,j;
+
+ for (i = 0; i < 1000; i++)
+ {
+ if (i == 100) break;
+ }
+
+ // 'breaking out of "for" loop'
+ testcases[count++] = new TestCase ( SECTION, 'breaking out of "for" loop',
+ 100, i);
+
+ j = 2000;
+
+ out1:
+ for (i = 0; i < 1000; i++)
+ {
+ if (i == 100)
+ {
+ out2:
+ for (j = 0; j < 1000; j++)
+ {
+ if (j == 500) break out1;
+ }
+ j = 2001;
+ }
+ j = 2002;
+ }
+
+ // 'breaking out of a "for" loop with a "label"'
+ testcases[count++] = new TestCase ( SECTION, 'breaking out of a "for" loop with a "label"',
+ 500, j);
+
+ i = 0;
+
+ while (i < 1000)
+ {
+ if (i == 100) break;
+ i++;
+ }
+
+ // 'breaking out of a "while" loop'
+ testcases[count++] = new TestCase ( SECTION, 'breaking out of a "while" loop',
+ 100, i );
+
+
+ j = 2000;
+ i = 0;
+
+ out3:
+ while (i < 1000)
+ {
+ if (i == 100)
+ {
+ j = 0;
+ out4:
+ while (j < 1000)
+ {
+ if (j == 500) break out3;
+ j++;
+ }
+ j = 2001;
+ }
+ j = 2002;
+ i++;
+ }
+
+ // 'breaking out of a "while" loop with a "label"'
+ testcases[count++] = new TestCase ( SECTION, 'breaking out of a "while" loop with a "label"',
+ 500, j);
+
+ i = 0;
+
+ do
+ {
+ if (i == 100) break;
+ i++;
+ } while (i < 1000);
+
+ // 'breaking out of a "do" loop'
+ testcases[count++] = new TestCase ( SECTION, 'breaking out of a "do" loop',
+ 100, i );
+
+ j = 2000;
+ i = 0;
+
+ out5:
+ do
+ {
+ if (i == 100)
+ {
+ j = 0;
+ out6:
+ do
+ {
+ if (j == 500) break out5;
+ j++;
+ }while (j < 1000);
+ j = 2001;
+ }
+ j = 2002;
+ i++;
+ }while (i < 1000);
+
+ // 'breaking out of a "do" loop with a "label"'
+ testcases[count++] = new TestCase ( SECTION, 'breaking out of a "do" loop with a "label"',
+ 500, j);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/statements/continue.js b/JavaScriptCore/tests/mozilla/js1_2/statements/continue.js
new file mode 100644
index 0000000..e27b9df
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/statements/continue.js
@@ -0,0 +1,175 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: continue.js
+ Description: 'Tests the continue statement'
+
+ Author: Nick Lerissa
+ Date: March 18, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'statements: continue';
+
+ writeHeaderToLog("Executing script: continue.js");
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ var i,j;
+
+ j = 0;
+ for (i = 0; i < 200; i++)
+ {
+ if (i == 100)
+ continue;
+ j++;
+ }
+
+ // '"continue" in a "for" loop'
+ testcases[count++] = new TestCase ( SECTION, '"continue" in "for" loop',
+ 199, j);
+
+
+ j = 0;
+ out1:
+ for (i = 0; i < 1000; i++)
+ {
+ if (i == 100)
+ {
+ out2:
+ for (var k = 0; k < 1000; k++)
+ {
+ if (k == 500) continue out1;
+ }
+ j = 3000;
+ }
+ j++;
+ }
+
+ // '"continue" in a "for" loop with a "label"'
+ testcases[count++] = new TestCase ( SECTION, '"continue" in "for" loop with a "label"',
+ 999, j);
+
+ i = 0;
+ j = 1;
+
+ while (i != j)
+ {
+ i++;
+ if (i == 100) continue;
+ j++;
+ }
+
+ // '"continue" in a "while" loop'
+ testcases[count++] = new TestCase ( SECTION, '"continue" in a "while" loop',
+ 100, j );
+
+ j = 0;
+ i = 0;
+ out3:
+ while (i < 1000)
+ {
+ if (i == 100)
+ {
+ var k = 0;
+ out4:
+ while (k < 1000)
+ {
+ if (k == 500)
+ {
+ i++;
+ continue out3;
+ }
+ k++;
+ }
+ j = 3000;
+ }
+ j++;
+ i++;
+ }
+
+ // '"continue" in a "while" loop with a "label"'
+ testcases[count++] = new TestCase ( SECTION, '"continue" in a "while" loop with a "label"',
+ 999, j);
+
+ i = 0;
+ j = 1;
+
+ do
+ {
+ i++;
+ if (i == 100) continue;
+ j++;
+ } while (i != j);
+
+
+ // '"continue" in a "do" loop'
+ testcases[count++] = new TestCase ( SECTION, '"continue" in a "do" loop',
+ 100, j );
+
+ j = 0;
+ i = 0;
+ out5:
+ do
+ {
+ if (i == 100)
+ {
+ var k = 0;
+ out6:
+ do
+ {
+ if (k == 500)
+ {
+ i++;
+ continue out5;
+ }
+ k++;
+ }while (k < 1000);
+ j = 3000;
+ }
+ j++;
+ i++;
+ }while (i < 1000);
+
+ // '"continue" in a "do" loop with a "label"'
+ testcases[count++] = new TestCase ( SECTION, '"continue" in a "do" loop with a "label"',
+ 999, j);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/statements/do_while.js b/JavaScriptCore/tests/mozilla/js1_2/statements/do_while.js
new file mode 100644
index 0000000..d54ac78
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/statements/do_while.js
@@ -0,0 +1,68 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: do_while.js
+ Description: 'This tests the new do_while loop'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'statements: do_while';
+
+ writeHeaderToLog('Executing script: do_while.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ var done = false;
+ var x = 0;
+ do
+ {
+ if (x++ == 3) done = true;
+ } while (!done);
+
+ testcases[count++] = new TestCase( SECTION, "do_while ",
+ 4, x);
+
+ //load('d:/javascript/tests/output/statements/do_while.js')
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/JavaScriptCore/tests/mozilla/js1_2/statements/switch.js b/JavaScriptCore/tests/mozilla/js1_2/statements/switch.js
new file mode 100644
index 0000000..f6678c5
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/statements/switch.js
@@ -0,0 +1,127 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: switch.js
+ Description: 'Tests the switch statement'
+
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=323696
+
+ Author: Nick Lerissa
+ Date: March 19, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'statements: switch';
+ var BUGNUMBER="323696";
+
+ writeHeaderToLog("Executing script: switch.js");
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ var var1 = "match string";
+ var match1 = false;
+ var match2 = false;
+ var match3 = false;
+
+ switch (var1)
+ {
+ case "match string":
+ match1 = true;
+ case "bad string 1":
+ match2 = true;
+ break;
+ case "bad string 2":
+ match3 = true;
+ }
+
+ testcases[count++] = new TestCase ( SECTION, 'switch statement',
+ true, match1);
+
+ testcases[count++] = new TestCase ( SECTION, 'switch statement',
+ true, match2);
+
+ testcases[count++] = new TestCase ( SECTION, 'switch statement',
+ false, match3);
+
+ var var2 = 3;
+
+ var match1 = false;
+ var match2 = false;
+ var match3 = false;
+ var match4 = false;
+ var match5 = false;
+
+ switch (var2)
+ {
+ case 1:
+/* switch (var1)
+ {
+ case "foo":
+ match1 = true;
+ break;
+ case 3:
+ match2 = true;
+ break;
+ }*/
+ match3 = true;
+ break;
+ case 2:
+ match4 = true;
+ break;
+ case 3:
+ match5 = true;
+ break;
+ }
+ testcases[count++] = new TestCase ( SECTION, 'switch statement',
+ false, match1);
+
+ testcases[count++] = new TestCase ( SECTION, 'switch statement',
+ false, match2);
+
+ testcases[count++] = new TestCase ( SECTION, 'switch statement',
+ false, match3);
+
+ testcases[count++] = new TestCase ( SECTION, 'switch statement',
+ false, match4);
+
+ testcases[count++] = new TestCase ( SECTION, 'switch statement',
+ true, match5);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/js1_2/statements/switch2.js b/JavaScriptCore/tests/mozilla/js1_2/statements/switch2.js
new file mode 100644
index 0000000..5d35f8c
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/statements/switch2.js
@@ -0,0 +1,188 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: switch2.js
+ Description: 'Tests the switch statement'
+
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=323696
+
+ Author: Norris Boyd
+ Date: July 31, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'statements: switch';
+ var BUGNUMBER="323626";
+
+ writeHeaderToLog("Executing script: switch2.js");
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // test defaults not at the end; regression test for a bug that
+ // nearly made it into 4.06
+ function f0(i) {
+ switch(i) {
+ default:
+ case "a":
+ case "b":
+ return "ab*"
+ case "c":
+ return "c";
+ case "d":
+ return "d";
+ }
+ return "";
+ }
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f0("a"), "ab*");
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f0("b"), "ab*");
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f0("*"), "ab*");
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f0("c"), "c");
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f0("d"), "d");
+
+ function f1(i) {
+ switch(i) {
+ case "a":
+ case "b":
+ default:
+ return "ab*"
+ case "c":
+ return "c";
+ case "d":
+ return "d";
+ }
+ return "";
+ }
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f1("a"), "ab*");
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f1("b"), "ab*");
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f1("*"), "ab*");
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f1("c"), "c");
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f1("d"), "d");
+
+ // Switch on integer; will use TABLESWITCH opcode in C engine
+ function f2(i) {
+ switch (i) {
+ case 0:
+ case 1:
+ return 1;
+ case 2:
+ return 2;
+ }
+ // with no default, control will fall through
+ return 3;
+ }
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f2(0), 1);
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f2(1), 1);
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f2(2), 2);
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f2(3), 3);
+
+ // empty switch: make sure expression is evaluated
+ var se = 0;
+ switch (se = 1) {
+ }
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ se, 1);
+
+ // only default
+ se = 0;
+ switch (se) {
+ default:
+ se = 1;
+ }
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ se, 1);
+
+ // in loop, break should only break out of switch
+ se = 0;
+ for (var i=0; i < 2; i++) {
+ switch (i) {
+ case 0:
+ case 1:
+ break;
+ }
+ se = 1;
+ }
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ se, 1);
+
+ // test "fall through"
+ se = 0;
+ i = 0;
+ switch (i) {
+ case 0:
+ se++;
+ /* fall through */
+ case 1:
+ se++;
+ break;
+ }
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ se, 2);
+
+ test();
+
+ // Needed: tests for evaluation time of case expressions.
+ // This issue was under debate at ECMA, so postponing for now.
+
+ function test() {
+ writeLineToLog("hi");
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
diff --git a/JavaScriptCore/tests/mozilla/js1_2/version120/boolean-001.js b/JavaScriptCore/tests/mozilla/js1_2/version120/boolean-001.js
new file mode 100644
index 0000000..55fafe4
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/version120/boolean-001.js
@@ -0,0 +1,73 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ * File Name: boolean-001.js
+ * Description:
+ *
+ * In JavaScript 1.2, new Boolean(false) evaluates to false.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "boolean-001.js";
+ var VERSION = "JS1_2";
+ startTest();
+ var TITLE = "new Boolean(false) should evaluate to false";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ BooleanTest( "new Boolean(true)", new Boolean(true), true );
+ BooleanTest( "new Boolean(false)", new Boolean(false), false );
+ BooleanTest( "true", true, true );
+ BooleanTest( "false", false, false );
+
+ test();
+
+function BooleanTest( string, object, expect ) {
+ if ( object ) {
+ result = true;
+ } else {
+ result = false;
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ string,
+ expect,
+ result );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/js1_2/version120/regress-99663.js b/JavaScriptCore/tests/mozilla/js1_2/version120/regress-99663.js
new file mode 100644
index 0000000..75131ee
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/version120/regress-99663.js
@@ -0,0 +1,172 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
+* Date: 09 October 2001
+*
+* SUMMARY: Regression test for Bugzilla bug 99663
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=99663
+*
+*******************************************************************************
+*******************************************************************************
+* ESSENTIAL!: this test should contain, or be loaded after, a call to
+*
+* version(120);
+*
+* Only JS version 1.2 or less has the behavior we're expecting here -
+*
+* Brendan: "The JS_SetVersion stickiness is necessary for tests such as
+* this one to work properly. I think the existing js/tests have been lucky
+* in dodging the buggy way that JS_SetVersion's effect can be undone by
+* function return."
+*
+* Note: it is the function statements for f1(), etc. that MUST be compiled
+* in JS version 1.2 or less for the test to pass -
+*
+*******************************************************************************
+*******************************************************************************
+*
+*
+* NOTE: the test uses the |it| object of SpiderMonkey; don't run it in Rhino -
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 99663;
+var summary = 'Regression test for Bugzilla bug 99663';
+/*
+ * This testcase expects error messages containing
+ * the phrase 'read-only' or something similar -
+ */
+var READONLY = /read\s*-?\s*only/;
+var READONLY_TRUE = 'a "read-only" error';
+var READONLY_FALSE = 'Error: ';
+var FAILURE = 'NO ERROR WAS GENERATED!';
+var status = '';
+var actual = '';
+var expect= '';
+var statusitems = [];
+var expectedvalues = [];
+var actualvalues = [];
+
+
+/*
+ * These MUST be compiled in JS1.2 or less for the test to work - see above
+ */
+function f1()
+{
+ with (it)
+ {
+ for (rdonly in this);
+ }
+}
+
+
+function f2()
+{
+ for (it.rdonly in this);
+}
+
+
+function f3(s)
+{
+ for (it[s] in this);
+}
+
+
+
+/*
+ * Begin testing by capturing actual vs. expected values.
+ * Initialize to FAILURE; this will get reset if all goes well -
+ */
+actual = FAILURE;
+try
+{
+ f1();
+}
+catch(e)
+{
+ actual = readOnly(e.message);
+}
+expect= READONLY_TRUE;
+status = 'Section 1 of test - got ' + actual;
+addThis();
+
+
+actual = FAILURE;
+try
+{
+ f2();
+}
+catch(e)
+{
+ actual = readOnly(e.message);
+}
+expect= READONLY_TRUE;
+status = 'Section 2 of test - got ' + actual;
+addThis();
+
+
+actual = FAILURE;
+try
+{
+ f3('rdonly');
+}
+catch(e)
+{
+ actual = readOnly(e.message);
+}
+expect= READONLY_TRUE;
+status = 'Section 3 of test - got ' + actual;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function readOnly(msg)
+{
+ if (msg.match(READONLY))
+ return READONLY_TRUE;
+ return READONLY_FALSE + msg;
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ writeLineToLog ('Bug Number ' + bug);
+ writeLineToLog ('STATUS: ' + summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ writeTestCaseResult(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+}
diff --git a/JavaScriptCore/tests/mozilla/js1_2/version120/shell.js b/JavaScriptCore/tests/mozilla/js1_2/version120/shell.js
new file mode 100644
index 0000000..e453344
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/js1_2/version120/shell.js
@@ -0,0 +1,24 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s):
+*/
+
+/* all files in this dir need version(120) called before they are *loaded* */
+
+version(120); \ No newline at end of file