aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/parserstress/tests/ecma_2/RegExp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/parserstress/tests/ecma_2/RegExp')
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/constructor-001.js99
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/exec-001.js73
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/exec-002.js221
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/function-001.js99
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/hex-001.js102
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/multiline-001.js101
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-001.js111
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-002.js126
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-003.js120
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/properties-001.js124
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/properties-002.js162
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/regexp-enumerate-001.js121
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/regress-001.js78
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/unicode-001.js92
16 files changed, 1630 insertions, 0 deletions
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/browser.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/constructor-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/constructor-001.js
new file mode 100644
index 0000000000..f1dba13b06
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/constructor-001.js
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla 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/MPL/
+ *
+ * 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 Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * 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 MPL, 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 MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'constructor-001.js';
+
+/**
+ * File Name: RegExp/constructor-001.js
+ * ECMA Section: 15.7.3.3
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/constructor-001";
+var VERSION = "ECMA_2";
+var TITLE = "new RegExp()";
+
+startTest();
+
+/*
+ * for each test case, verify:
+ * - verify that [[Class]] property is RegExp
+ * - prototype property should be set to RegExp.prototype
+ * - source is set to the empty string
+ * - global property is set to false
+ * - ignoreCase property is set to false
+ * - multiline property is set to false
+ * - lastIndex property is set to 0
+ */
+
+RegExp.prototype.getClassProperty = Object.prototype.toString;
+var re = new RegExp();
+
+AddTestCase(
+ "RegExp.prototype.getClassProperty = Object.prototype.toString; " +
+ "(new RegExp()).getClassProperty()",
+ "[object RegExp]",
+ re.getClassProperty() );
+
+AddTestCase(
+ "(new RegExp()).source",
+ "",
+ re.source );
+
+AddTestCase(
+ "(new RegExp()).global",
+ false,
+ re.global );
+
+AddTestCase(
+ "(new RegExp()).ignoreCase",
+ false,
+ re.ignoreCase );
+
+AddTestCase(
+ "(new RegExp()).multiline",
+ false,
+ re.multiline );
+
+AddTestCase(
+ "(new RegExp()).lastIndex",
+ 0,
+ re.lastIndex );
+
+test()
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/exec-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/exec-001.js
new file mode 100644
index 0000000000..2d1bab472c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/exec-001.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla 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/MPL/
+ *
+ * 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 Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * 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 MPL, 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 MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'exec-001.js';
+
+/**
+ * File Name: RegExp/exec-001.js
+ * ECMA Section: 15.7.5.3
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/exec-001";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp.prototype.exec(string)";
+
+startTest();
+
+/*
+ * for each test case, verify:
+ * - type of object returned
+ * - length of the returned array
+ * - value of lastIndex
+ * - value of index
+ * - value of input
+ * - value of the array indices
+ */
+
+// test cases without subpatterns
+// test cases with subpatterns
+// global property is true
+// global property is false
+// test cases in which the exec returns null
+
+AddTestCase("NO TESTS EXIST", "PASSED", "Test not implemented");
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/exec-002.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/exec-002.js
new file mode 100644
index 0000000000..026f27d9d4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/exec-002.js
@@ -0,0 +1,221 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla 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/MPL/
+ *
+ * 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 Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * 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 MPL, 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 MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'exec-002.js';
+
+/**
+ * File Name: RegExp/exec-002.js
+ * ECMA Section: 15.7.5.3
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Test cases provided by rogerl@netscape.com
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/exec-002";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp.prototype.exec(string)";
+
+startTest();
+
+/*
+ * for each test case, verify:
+ * - type of object returned
+ * - length of the returned array
+ * - value of lastIndex
+ * - value of index
+ * - value of input
+ * - value of the array indices
+ */
+
+AddRegExpCases(
+ /(a|d|q|)x/i,
+ "bcaDxqy",
+ 3,
+ ["Dx", "D"] );
+
+AddRegExpCases(
+ /(a|(e|q))(x|y)/,
+ "bcaddxqy",
+ 6,
+ ["qy","q","q","y"] );
+
+
+AddRegExpCases(
+ /a+b+d/,
+ "aabbeeaabbs",
+ 0,
+ null );
+
+AddRegExpCases(
+ /a*b/,
+ "aaadaabaaa",
+ 4,
+ ["aab"] );
+
+AddRegExpCases(
+ /a*b/,
+ "dddb",
+ 3,
+ ["b"] );
+
+AddRegExpCases(
+ /a*b/,
+ "xxx",
+ 0,
+ null );
+
+AddRegExpCases(
+ /x\d\dy/,
+ "abcx45ysss235",
+ 3,
+ ["x45y"] );
+
+AddRegExpCases(
+ /[^abc]def[abc]+/,
+ "abxdefbb",
+ 2,
+ ["xdefbb"] );
+
+AddRegExpCases(
+ /(a*)baa/,
+ "ccdaaabaxaabaa",
+ 9,
+ ["aabaa", "aa"] );
+
+AddRegExpCases(
+ /(a*)baa/,
+ "aabaa",
+ 0,
+ ["aabaa", "aa"] );
+
+AddRegExpCases(
+ /q(a|b)*q/,
+ "xxqababqyy",
+ 2,
+ ["qababq", "b"] );
+
+AddRegExpCases(
+ /(a(.|[^d])c)*/,
+ "adcaxc",
+ 0,
+ ["adcaxc", "axc", "x"] );
+
+AddRegExpCases(
+ /(a*)b\1/,
+ "abaaaxaabaayy",
+ 0,
+ ["aba", "a"] );
+
+AddRegExpCases(
+ /(a*)b\1/,
+ "abaaaxaabaayy",
+ 0,
+ ["aba", "a"] );
+
+AddRegExpCases(
+ /(a*)b\1/,
+ "cccdaaabaxaabaayy",
+ 6,
+ ["aba", "a"] );
+
+AddRegExpCases(
+ /(a*)b\1/,
+ "cccdaaabqxaabaayy",
+ 7,
+ ["b", ""] );
+
+AddRegExpCases(
+ /"(.|[^"\\\\])*"/,
+ 'xx\"makudonarudo\"yy',
+ 2,
+ ["\"makudonarudo\"", "o"] );
+
+ AddRegExpCases(
+ /"(.|[^"\\\\])*"/,
+ "xx\"ma\"yy",
+ 2,
+ ["\"ma\"", "a"] );
+
+ test();
+
+ function AddRegExpCases(
+ regexp, pattern, index, matches_array ) {
+
+// prevent a runtime error
+
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
+ AddTestCase(
+ regexp + ".exec(" + pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+
+ return;
+ }
+ AddTestCase(
+ regexp + ".exec(" + pattern +").length",
+ matches_array.length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ regexp + ".exec(" + pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ regexp + ".exec(" + pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+ AddTestCase(
+ regexp + ".exec(" + pattern +").toString()",
+ matches_array.toString(),
+ regexp.exec(pattern).toString() );
+/*
+ var limit = matches_array.length > regexp.exec(pattern).length
+ ? matches_array.length
+ : regexp.exec(pattern).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ regexp + ".exec(" + pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
+*/
+ }
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/function-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/function-001.js
new file mode 100644
index 0000000000..8b219b935b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/function-001.js
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla 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/MPL/
+ *
+ * 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 Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * 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 MPL, 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 MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'function-001.js';
+
+/**
+ * File Name: RegExp/function-001.js
+ * ECMA Section: 15.7.2.1
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/function-001";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp( pattern, flags )";
+
+startTest();
+
+/*
+ * for each test case, verify:
+ * - verify that [[Class]] property is RegExp
+ * - prototype property should be set to RegExp.prototype
+ * - source is set to the empty string
+ * - global property is set to false
+ * - ignoreCase property is set to false
+ * - multiline property is set to false
+ * - lastIndex property is set to 0
+ */
+
+RegExp.prototype.getClassProperty = Object.prototype.toString;
+var re = new RegExp();
+
+AddTestCase(
+ "RegExp.prototype.getClassProperty = Object.prototype.toString; " +
+ "(new RegExp()).getClassProperty()",
+ "[object RegExp]",
+ re.getClassProperty() );
+
+AddTestCase(
+ "(new RegExp()).source",
+ "",
+ re.source );
+
+AddTestCase(
+ "(new RegExp()).global",
+ false,
+ re.global );
+
+AddTestCase(
+ "(new RegExp()).ignoreCase",
+ false,
+ re.ignoreCase );
+
+AddTestCase(
+ "(new RegExp()).multiline",
+ false,
+ re.multiline );
+
+AddTestCase(
+ "(new RegExp()).lastIndex",
+ 0,
+ re.lastIndex );
+
+test()
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/hex-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/hex-001.js
new file mode 100644
index 0000000000..3e85ac7abf
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/hex-001.js
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla 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/MPL/
+ *
+ * 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 Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * 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 MPL, 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 MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'hex-001.js';
+
+/**
+ * File Name: RegExp/hex-001.js
+ * ECMA Section: 15.7.3.1
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ * Positive test cases for constructing a RegExp object
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/hex-001";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp patterns that contain HexicdecimalEscapeSequences";
+
+startTest();
+
+// These examples come from 15.7.1, HexidecimalEscapeSequence
+
+AddRegExpCases( new RegExp("\x41"), "new RegExp('\\x41')", "A", "A", 1, 0, ["A"] );
+AddRegExpCases( new RegExp("\x412"),"new RegExp('\\x412')", "A2", "A2", 1, 0, ["A2"] );
+AddRegExpCases( new RegExp("\x1g"), "new RegExp('\\x1g')", "x1g","x1g", 1, 0, ["x1g"] );
+
+AddRegExpCases( new RegExp("A"), "new RegExp('A')", "\x41", "\\x41", 1, 0, ["A"] );
+AddRegExpCases( new RegExp("A"), "new RegExp('A')", "\x412", "\\x412", 1, 0, ["A"] );
+AddRegExpCases( new RegExp("^x"), "new RegExp('^x')", "x412", "x412", 1, 0, ["x"]);
+AddRegExpCases( new RegExp("A"), "new RegExp('A')", "A2", "A2", 1, 0, ["A"] );
+
+test();
+
+function AddRegExpCases(
+ regexp, str_regexp, pattern, str_pattern, length, index, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
+ AddTestCase(
+ str_regexp + ".exec(" + pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+
+ return;
+ }
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").length",
+ length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/multiline-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/multiline-001.js
new file mode 100644
index 0000000000..102f91fcd4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/multiline-001.js
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla 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/MPL/
+ *
+ * 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 Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * 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 MPL, 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 MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'multiline-001.js';
+
+/**
+ * File Name: RegExp/multiline-001.js
+ * ECMA Section:
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Date: 19 February 1999
+ */
+
+var SECTION = "RegExp/multiline-001";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp: multiline flag";
+var BUGNUMBER="343901";
+
+startTest();
+
+var woodpeckers = "ivory-billed\ndowny\nhairy\nacorn\nyellow-bellied sapsucker\n" +
+ "northern flicker\npileated\n";
+
+AddRegExpCases( /.*[y]$/m, woodpeckers, woodpeckers.indexOf("downy"), ["downy"] );
+
+AddRegExpCases( /.*[d]$/m, woodpeckers, woodpeckers.indexOf("ivory-billed"), ["ivory-billed"] );
+
+test();
+
+
+function AddRegExpCases
+( regexp, pattern, index, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
+ AddTestCase(
+ regexp + ".exec(" + pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+
+ return;
+ }
+
+ AddTestCase(
+ regexp.toString() + ".exec(" + pattern +").length",
+ matches_array.length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ regexp.toString() + ".exec(" + pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ regexp + ".exec(" + pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
+ AddTestCase(
+ regexp + ".exec(" + pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-001.js
new file mode 100644
index 0000000000..1c520750ce
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-001.js
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla 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/MPL/
+ *
+ * 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 Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * 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 MPL, 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 MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'octal-001.js';
+
+/**
+ * File Name: RegExp/octal-001.js
+ * ECMA Section: 15.7.1
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ * Simple test cases for matching OctalEscapeSequences.
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/octal-001.js";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp patterns that contain OctalEscapeSequences";
+var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346196";
+
+startTest();
+
+
+// backreference
+AddRegExpCases(
+ /(.)\1/,
+ "/(.)\\1/",
+ "HI!!",
+ "HI!",
+ 2,
+ ["!!", "!"] );
+
+test();
+
+function AddRegExpCases(
+ regexp, str_regexp, pattern, str_pattern, index, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
+ AddTestCase(
+ regexp + ".exec(" + str_pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+
+ return;
+ }
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").length",
+ matches_array.length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").toString()",
+ matches_array.toString(),
+ regexp.exec(pattern).toString() );
+/*
+ var limit = matches_array.length > regexp.exec(pattern).length
+ ? matches_array.length
+ : regexp.exec(pattern).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
+*/
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-002.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-002.js
new file mode 100644
index 0000000000..b654e5e68a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-002.js
@@ -0,0 +1,126 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla 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/MPL/
+ *
+ * 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 Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * 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 MPL, 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 MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'octal-002.js';
+
+/**
+ * File Name: RegExp/octal-002.js
+ * ECMA Section: 15.7.1
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ * Simple test cases for matching OctalEscapeSequences.
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/octal-002.js";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp patterns that contain OctalEscapeSequences";
+var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346189";
+
+startTest();
+
+// backreference
+AddRegExpCases(
+ /(.)(.)(.)(.)(.)(.)(.)(.)\8/,
+ "/(.)(.)(.)(.)(.)(.)(.)(.)\\8",
+ "aabbccaaabbbccc",
+ "aabbccaaabbbccc",
+ 0,
+ ["aabbccaaa", "a", "a", "b", "b", "c", "c", "a", "a"] );
+
+AddRegExpCases(
+ /(.)(.)(.)(.)(.)(.)(.)(.)(.)\9/,
+ "/(.)(.)(.)(.)(.)(.)(.)(.)\\9",
+ "aabbccaabbcc",
+ "aabbccaabbcc",
+ 0,
+ ["aabbccaabb", "a", "a", "b", "b", "c", "c", "a", "a", "b"] );
+
+AddRegExpCases(
+ /(.)(.)(.)(.)(.)(.)(.)(.)(.)\8/,
+ "/(.)(.)(.)(.)(.)(.)(.)(.)(.)\\8",
+ "aabbccaababcc",
+ "aabbccaababcc",
+ 0,
+ ["aabbccaaba", "a", "a", "b", "b", "c", "c", "a", "a", "b"] );
+
+test();
+
+function AddRegExpCases(
+ regexp, str_regexp, pattern, str_pattern, index, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
+ AddTestCase(
+ regexp + ".exec(" + str_pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+
+ return;
+ }
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").length",
+ matches_array.length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").toString()",
+ matches_array.toString(),
+ regexp.exec(pattern).toString() );
+/*
+ var limit = matches_array.length > regexp.exec(pattern).length
+ ? matches_array.length
+ : regexp.exec(pattern).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
+*/
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-003.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-003.js
new file mode 100644
index 0000000000..ee07ca602b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-003.js
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla 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/MPL/
+ *
+ * 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 Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * 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 MPL, 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 MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'octal-003.js';
+
+/**
+ * File Name: RegExp/octal-003.js
+ * ECMA Section: 15.7.1
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ * Simple test cases for matching OctalEscapeSequences.
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ *
+ * Revised: 02 August 2002
+ * Author: pschwartau@netscape.com
+ *
+ * WHY: the original test expected the regexp /.\011/
+ * to match 'a' + String.fromCharCode(0) + '11'
+ *
+ * This is incorrect: the string is a 4-character string consisting of
+ * the characters <'a'>, <nul>, <'1'>, <'1'>. By contrast, the \011 in the
+ * regexp should be parsed as a single token: it is the octal escape sequence
+ * for the horizontal tab character '\t' === '\u0009' === '\x09' === '\011'.
+ *
+ * So the regexp consists of 2 characters: <any-character>, <'\t'>.
+ * There is no match between the regexp and the string.
+ *
+ * See the testcase ecma_3/RegExp/octal-002.js for an elaboration.
+ *
+ */
+var SECTION = "RegExp/octal-003.js";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp patterns that contain OctalEscapeSequences";
+var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346132";
+
+startTest();
+
+AddRegExpCases( /.\011/, "/\\011/", "a" + String.fromCharCode(0) + "11", "a\\011", 0, null );
+
+test();
+
+function AddRegExpCases(
+ regexp, str_regexp, pattern, str_pattern, index, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
+ AddTestCase(
+ regexp + ".exec(" + str_pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+
+ return;
+ }
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").length",
+ matches_array.length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").input",
+ escape(pattern),
+ escape(regexp.exec(pattern).input) );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").toString()",
+ matches_array.toString(),
+ escape(regexp.exec(pattern).toString()) );
+
+ var limit = matches_array.length > regexp.exec(pattern).length
+ ? matches_array.length
+ : regexp.exec(pattern).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
+ matches_array[matches],
+ escape(regexp.exec(pattern)[matches]) );
+ }
+
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/properties-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/properties-001.js
new file mode 100644
index 0000000000..7d2913cc53
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/properties-001.js
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla 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/MPL/
+ *
+ * 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 Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * 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 MPL, 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 MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'properties-001.js';
+
+/**
+ * File Name: RegExp/properties-001.js
+ * ECMA Section: 15.7.6.js
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/properties-001.js";
+var VERSION = "ECMA_2";
+var TITLE = "Properties of RegExp Instances";
+var BUGNUMBER ="";
+
+startTest();
+
+AddRegExpCases( new RegExp, "", false, false, false, 0 );
+AddRegExpCases( /.*/, ".*", false, false, false, 0 );
+AddRegExpCases( /[\d]{5}/g, "[\\d]{5}", true, false, false, 0 );
+AddRegExpCases( /[\S]?$/i, "[\\S]?$", false, true, false, 0 );
+AddRegExpCases( /^([a-z]*)[^\w\s\f\n\r]+/m, "^([a-z]*)[^\\w\\s\\f\\n\\r]+", false, false, true, 0 );
+AddRegExpCases( /[\D]{1,5}[\ -][\d]/gi, "[\\D]{1,5}[\\ -][\\d]", true, true, false, 0 );
+AddRegExpCases( /[a-zA-Z0-9]*/gm, "[a-zA-Z0-9]*", true, false, true, 0 );
+AddRegExpCases( /x|y|z/gim, "x|y|z", true, true, true, 0 );
+
+AddRegExpCases( /\u0051/im, "\\u0051", false, true, true, 0 );
+AddRegExpCases( /\x45/gm, "\\x45", true, false, true, 0 );
+AddRegExpCases( /\097/gi, "\\097", true, true, false, 0 );
+
+test();
+
+function AddRegExpCases( re, s, g, i, m, l ) {
+
+ AddTestCase( re + ".test == RegExp.prototype.test",
+ true,
+ re.test == RegExp.prototype.test );
+
+ AddTestCase( re + ".toString == RegExp.prototype.toString",
+ true,
+ re.toString == RegExp.prototype.toString );
+
+ AddTestCase( re + ".contructor == RegExp.prototype.constructor",
+ true,
+ re.constructor == RegExp.prototype.constructor );
+
+ AddTestCase( re + ".compile == RegExp.prototype.compile",
+ true,
+ re.compile == RegExp.prototype.compile );
+
+ AddTestCase( re + ".exec == RegExp.prototype.exec",
+ true,
+ re.exec == RegExp.prototype.exec );
+
+ // properties
+
+ AddTestCase( re + ".source",
+ s,
+ re.source );
+
+/*
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=225550 changed
+ * the behavior of toString() and toSource() on empty regexps.
+ * So branch if |s| is the empty string -
+ */
+ var S = s? s : '(?:)';
+
+ AddTestCase( re + ".toString()",
+ "/" + S +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""),
+ re.toString() );
+
+ AddTestCase( re + ".global",
+ g,
+ re.global );
+
+ AddTestCase( re + ".ignoreCase",
+ i,
+ re.ignoreCase );
+
+ AddTestCase( re + ".multiline",
+ m,
+ re.multiline);
+
+ AddTestCase( re + ".lastIndex",
+ l,
+ re.lastIndex );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/properties-002.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/properties-002.js
new file mode 100644
index 0000000000..1fcfd8d219
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/properties-002.js
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla 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/MPL/
+ *
+ * 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 Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * 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 MPL, 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 MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'properties-002.js';
+
+/**
+ * File Name: RegExp/properties-002.js
+ * ECMA Section: 15.7.6.js
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+//-----------------------------------------------------------------------------
+var SECTION = "RegExp/properties-002.js";
+var VERSION = "ECMA_2";
+var TITLE = "Properties of RegExp Instances";
+var BUGNUMBER ="124339";
+
+startTest();
+
+re_1 = /\cA?/g;
+re_1.lastIndex = Math.pow(2,31);
+AddRegExpCases( re_1, "\\cA?", true, false, false, Math.pow(2,31) );
+
+re_2 = /\w*/i;
+re_2.lastIndex = Math.pow(2,32) -1;
+AddRegExpCases( re_2, "\\w*", false, true, false, Math.pow(2,32)-1 );
+
+re_3 = /\*{0,80}/m;
+re_3.lastIndex = Math.pow(2,31) -1;
+AddRegExpCases( re_3, "\\*{0,80}", false, false, true, Math.pow(2,31) -1 );
+
+re_4 = /^./gim;
+re_4.lastIndex = Math.pow(2,30) -1;
+AddRegExpCases( re_4, "^.", true, true, true, Math.pow(2,30) -1 );
+
+re_5 = /\B/;
+re_5.lastIndex = Math.pow(2,30);
+AddRegExpCases( re_5, "\\B", false, false, false, Math.pow(2,30) );
+
+/*
+ * Brendan: "need to test cases Math.pow(2,32) and greater to see
+ * whether they round-trip." Reason: thanks to the work done in
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=124339, lastIndex
+ * is now stored as a double instead of a uint32 (unsigned integer).
+ *
+ * Note 2^32 -1 is the upper bound for uint32's, but doubles can go
+ * all the way up to Number.MAX_VALUE. So that's why we need cases
+ * between those two numbers.
+ *
+ */
+re_6 = /\B/;
+re_6.lastIndex = Math.pow(2,32);
+AddRegExpCases( re_6, "\\B", false, false, false, Math.pow(2,32) );
+
+re_7 = /\B/;
+re_7.lastIndex = Math.pow(2,32) + 1;
+AddRegExpCases( re_7, "\\B", false, false, false, Math.pow(2,32) + 1 );
+
+re_8 = /\B/;
+re_8.lastIndex = Math.pow(2,32) * 2;
+AddRegExpCases( re_8, "\\B", false, false, false, Math.pow(2,32) * 2 );
+
+re_9 = /\B/;
+re_9.lastIndex = Math.pow(2,40);
+AddRegExpCases( re_9, "\\B", false, false, false, Math.pow(2,40) );
+
+re_10 = /\B/;
+re_10.lastIndex = Number.MAX_VALUE;
+AddRegExpCases( re_10, "\\B", false, false, false, Number.MAX_VALUE );
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function AddRegExpCases( re, s, g, i, m, l ){
+
+ AddTestCase( re + ".test == RegExp.prototype.test",
+ true,
+ re.test == RegExp.prototype.test );
+
+ AddTestCase( re + ".toString == RegExp.prototype.toString",
+ true,
+ re.toString == RegExp.prototype.toString );
+
+ AddTestCase( re + ".contructor == RegExp.prototype.constructor",
+ true,
+ re.constructor == RegExp.prototype.constructor );
+
+ AddTestCase( re + ".compile == RegExp.prototype.compile",
+ true,
+ re.compile == RegExp.prototype.compile );
+
+ AddTestCase( re + ".exec == RegExp.prototype.exec",
+ true,
+ re.exec == RegExp.prototype.exec );
+
+ // properties
+
+ AddTestCase( re + ".source",
+ s,
+ re.source );
+
+ AddTestCase( re + ".toString()",
+ "/" + s +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""),
+ re.toString() );
+
+ AddTestCase( re + ".global",
+ g,
+ re.global );
+
+ AddTestCase( re + ".ignoreCase",
+ i,
+ re.ignoreCase );
+
+ AddTestCase( re + ".multiline",
+ m,
+ re.multiline);
+
+ AddTestCase( re + ".lastIndex",
+ l,
+ re.lastIndex );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/regexp-enumerate-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/regexp-enumerate-001.js
new file mode 100644
index 0000000000..c26a1216ea
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/regexp-enumerate-001.js
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla 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/MPL/
+ *
+ * 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 Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * 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 MPL, 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 MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'regexp-enumerate-001.js';
+
+/**
+ File Name: regexp-enumerate-001.js
+ ECMA V2 Section:
+ Description: Regression Test.
+
+ If instance Native Object have properties that are enumerable,
+ JavaScript enumerated through the properties twice. This only
+ happened if objects had been instantiated, but their properties
+ had not been enumerated. ie, the object inherited properties
+ from its prototype that are enumerated.
+
+ In the core JavaScript, this is only a problem with RegExp
+ objects, since the inherited properties of most core JavaScript
+ objects are not enumerated.
+
+ Author: christine@netscape.com, pschwartau@netscape.com
+ Date: 12 November 1997
+ Modified: 14 July 2002
+ Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155291
+ ECMA-262 Ed.3 Sections 15.10.7.1 through 15.10.7.5
+ RegExp properties should be DontEnum
+ *
+ */
+// onerror = err;
+
+var SECTION = "regexp-enumerate-001";
+var VERSION = "ECMA_2";
+var TITLE = "Regression Test for Enumerating Properties";
+
+var BUGNUMBER="339403";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+/*
+ * This test expects RegExp instances to have four enumerated properties:
+ * source, global, ignoreCase, and lastIndex
+ *
+ * 99.01.25: now they also have a multiLine instance property.
+ *
+ */
+
+
+var r = new RegExp();
+
+var e = new Array();
+
+var t = new TestRegExp();
+
+for ( p in r ) { e[e.length] = { property:p, value:r[p] }; t.addProperty( p, r[p]) };
+
+new TestCase( SECTION,
+ "r = new RegExp(); e = new Array(); "+
+ "for ( p in r ) { e[e.length] = { property:p, value:r[p] }; e.length",
+ 0,
+ e.length );
+
+test();
+
+function TestRegExp() {
+ this.addProperty = addProperty;
+}
+function addProperty(name, value) {
+ var pass = false;
+
+ if ( eval("this."+name) != void 0 ) {
+ pass = true;
+ } else {
+ eval( "this."+ name+" = "+ false );
+ }
+
+ new TestCase( SECTION,
+ "Property: " + name +" already enumerated?",
+ false,
+ pass );
+
+ if ( gTestcases[ gTestcases.length-1].passed == false ) {
+ gTestcases[gTestcases.length-1].reason = "property already enumerated";
+
+ }
+
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/regress-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/regress-001.js
new file mode 100644
index 0000000000..219ce245ee
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/regress-001.js
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla 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/MPL/
+ *
+ * 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 Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * 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 MPL, 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 MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'regress-001.js';
+
+/**
+ * File Name: RegExp/regress-001.js
+ * ECMA Section: N/A
+ * Description: Regression test case:
+ * JS regexp anchoring on empty match bug
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=2157
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/hex-001.js";
+var VERSION = "ECMA_2";
+var TITLE = "JS regexp anchoring on empty match bug";
+var BUGNUMBER = "2157";
+
+startTest();
+
+AddRegExpCases( /a||b/(''),
+ "//a||b/('')",
+ 1,
+ [''] );
+
+test();
+
+function AddRegExpCases( regexp, str_regexp, length, matches_array ) {
+
+ AddTestCase(
+ "( " + str_regexp + " ).length",
+ regexp.length,
+ regexp.length );
+
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
+ AddTestCase(
+ "( " + str_regexp + " )[" + matches +"]",
+ matches_array[matches],
+ regexp[matches] );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/shell.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/shell.js
new file mode 100644
index 0000000000..9b4657d963
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'RegExp';
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/unicode-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/unicode-001.js
new file mode 100644
index 0000000000..79a3212a2e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/unicode-001.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla 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/MPL/
+ *
+ * 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 Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * 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 MPL, 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 MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'unicode-001.js';
+
+/**
+ * File Name: RegExp/unicode-001.js
+ * ECMA Section: 15.7.3.1
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ * Positive test cases for constructing a RegExp object
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/unicode-001.js";
+var VERSION = "ECMA_2";
+var TITLE = "new RegExp( pattern, flags )";
+
+startTest();
+
+// These examples come from 15.7.1, UnicodeEscapeSequence
+
+AddRegExpCases( /\u0041/, "/\\u0041/", "A", "A", 1, 0, ["A"] );
+AddRegExpCases( /\u00412/, "/\\u00412/", "A2", "A2", 1, 0, ["A2"] );
+AddRegExpCases( /\u00412/, "/\\u00412/", "A2", "A2", 1, 0, ["A2"] );
+AddRegExpCases( /\u001g/, "/\\u001g/", "u001g", "u001g", 1, 0, ["u001g"] );
+
+AddRegExpCases( /A/, "/A/", "\u0041", "\\u0041", 1, 0, ["A"] );
+AddRegExpCases( /A/, "/A/", "\u00412", "\\u00412", 1, 0, ["A"] );
+AddRegExpCases( /A2/, "/A2/", "\u00412", "\\u00412", 1, 0, ["A2"]);
+AddRegExpCases( /A/, "/A/", "A2", "A2", 1, 0, ["A"] );
+
+test();
+
+function AddRegExpCases(
+ regexp, str_regexp, pattern, str_pattern, length, index, matches_array ) {
+
+ AddTestCase(
+ str_regexp + " .exec(" + str_pattern +").length",
+ length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ str_regexp + " .exec(" + str_pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ str_regexp + " .exec(" + str_pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
+ AddTestCase(
+ str_regexp + " .exec(" + str_pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
+}