summaryrefslogtreecommitdiffstats
path: root/js/src/tests/js1_2/regress
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/js1_2/regress')
-rw-r--r--js/src/tests/js1_2/regress/browser.js0
-rw-r--r--js/src/tests/js1_2/regress/regress-144834.js50
-rw-r--r--js/src/tests/js1_2/regress/regress-7703.js69
-rw-r--r--js/src/tests/js1_2/regress/shell.js0
4 files changed, 119 insertions, 0 deletions
diff --git a/js/src/tests/js1_2/regress/browser.js b/js/src/tests/js1_2/regress/browser.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/js1_2/regress/browser.js
diff --git a/js/src/tests/js1_2/regress/regress-144834.js b/js/src/tests/js1_2/regress/regress-144834.js
new file mode 100644
index 000000000..1db9babaf
--- /dev/null
+++ b/js/src/tests/js1_2/regress/regress-144834.js
@@ -0,0 +1,50 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/*
+ *
+ * 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 BUGNUMBER = 144834;
+var summary = 'Local var having same name as switch label inside function';
+
+print(BUGNUMBER);
+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);
+
+AddTestCase('Do not crash', 'No Crash', 'No Crash');
+test();
diff --git a/js/src/tests/js1_2/regress/regress-7703.js b/js/src/tests/js1_2/regress/regress-7703.js
new file mode 100644
index 000000000..1ea5a34d5
--- /dev/null
+++ b/js/src/tests/js1_2/regress/regress-7703.js
@@ -0,0 +1,69 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
+
+/**
+ * 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/js/src/tests/js1_2/regress/shell.js b/js/src/tests/js1_2/regress/shell.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/js1_2/regress/shell.js