summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_6/RegExp
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-19 15:18:37 +0100
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-19 15:18:37 +0100
commit6822460d3b0d4609ee5d4e1ab4b093799ed06580 (patch)
tree9bc036539687d788ab61e2f5aabc6729a4e6a3d3 /js/src/tests/ecma_6/RegExp
parent213f9ea384c71eac84667d65a21dc96e422798db (diff)
downloadUXP-6822460d3b0d4609ee5d4e1ab4b093799ed06580.tar
UXP-6822460d3b0d4609ee5d4e1ab4b093799ed06580.tar.gz
UXP-6822460d3b0d4609ee5d4e1ab4b093799ed06580.tar.lz
UXP-6822460d3b0d4609ee5d4e1ab4b093799ed06580.tar.xz
UXP-6822460d3b0d4609ee5d4e1ab4b093799ed06580.zip
Bug 1317309: Throw a TypeError when passing a Symbol value to ToAtom
Issue #78 [Depends on] Bug 883377: Implement ES6 function "name" property semantics
Diffstat (limited to 'js/src/tests/ecma_6/RegExp')
-rw-r--r--js/src/tests/ecma_6/RegExp/compile-symbol.js14
-rw-r--r--js/src/tests/ecma_6/RegExp/constructor-symbol.js14
2 files changed, 28 insertions, 0 deletions
diff --git a/js/src/tests/ecma_6/RegExp/compile-symbol.js b/js/src/tests/ecma_6/RegExp/compile-symbol.js
new file mode 100644
index 000000000..9eea1124c
--- /dev/null
+++ b/js/src/tests/ecma_6/RegExp/compile-symbol.js
@@ -0,0 +1,14 @@
+/* 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/. */
+
+for (let sym of [Symbol.iterator, Symbol(), Symbol("description")]) {
+ let re = /a/;
+
+ assertEq(re.source, "a");
+ assertThrowsInstanceOf(() => re.compile(sym), TypeError);
+ assertEq(re.source, "a");
+}
+
+if (typeof reportCompare === 'function')
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/RegExp/constructor-symbol.js b/js/src/tests/ecma_6/RegExp/constructor-symbol.js
new file mode 100644
index 000000000..503d7e5a8
--- /dev/null
+++ b/js/src/tests/ecma_6/RegExp/constructor-symbol.js
@@ -0,0 +1,14 @@
+/* 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/. */
+
+for (let sym of [Symbol.iterator, Symbol(), Symbol("description")]) {
+ assertThrowsInstanceOf(() => RegExp(sym), TypeError);
+ assertThrowsInstanceOf(() => new RegExp(sym), TypeError);
+
+ assertThrowsInstanceOf(() => RegExp(sym, "g"), TypeError);
+ assertThrowsInstanceOf(() => new RegExp(sym, "g"), TypeError);
+}
+
+if (typeof reportCompare === 'function')
+ reportCompare(0, 0);