summaryrefslogtreecommitdiffstats
path: root/js/src/tests/js1_2/function/regexparg-1.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/tests/js1_2/function/regexparg-1.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/js1_2/function/regexparg-1.js')
-rw-r--r--js/src/tests/js1_2/function/regexparg-1.js71
1 files changed, 71 insertions, 0 deletions
diff --git a/js/src/tests/js1_2/function/regexparg-1.js b/js/src/tests/js1_2/function/regexparg-1.js
new file mode 100644
index 000000000..16c25bf9d
--- /dev/null
+++ b/js/src/tests/js1_2/function/regexparg-1.js
@@ -0,0 +1,71 @@
+/* -*- tab-width: 2; 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: 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 statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+print("Note: Bug 61911 changed the behavior of typeof regexp in Gecko 1.9.");
+print("Prior to Gecko 1.9, typeof regexp returned 'function'.");
+print("However in Gecko 1.9 and later, typeof regexp will return 'object'.");
+
+function f(x) {return x;}
+
+x = f(/abc/);
+
+new TestCase( SECTION,
+ "function f(x) {return x;}; f()",
+ void 0,
+ f() );
+
+new TestCase( SECTION,
+ "f(\"hi\")",
+ "hi",
+ f("hi") );
+
+new TestCase( SECTION,
+ "new f(/abc/) +''",
+ "/abc/",
+ new f(/abc/) +"" );
+
+new TestCase( SECTION,
+ "f(/abc/)+'')",
+ "/abc/",
+ f(/abc/) +'');
+
+new TestCase( SECTION,
+ "typeof f(/abc/)",
+ "object",
+ typeof f(/abc/) );
+
+new TestCase( SECTION,
+ "typeof new f(/abc/)",
+ "object",
+ typeof new f(/abc/) );
+
+new TestCase( SECTION,
+ "x = new f(/abc/); x.exec(\"hi\")",
+ null,
+ x.exec("hi") );
+
+
+// js> x()
+test();