summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-subclass-instance.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-subclass-instance.js')
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-subclass-instance.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-subclass-instance.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-subclass-instance.js
new file mode 100644
index 0000000000..66f6e3f5a6
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-subclass-instance.js
@@ -0,0 +1,28 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regexp.prototype.compile
+description: RegExp.prototype.compile throws a TypeError for calls on subclasses
+features: [legacy-regexp,class]
+---*/
+
+const subclass_regexp = new (class extends RegExp {})("");
+
+assert.throws(
+ TypeError,
+ function () {
+ subclass_regexp.compile();
+ },
+ "`subclass_regexp.compile()` throws TypeError"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ RegExp.prototype.compile.call(subclass_regexp);
+ },
+ "`RegExp.prototype.compile.call(subclass_regexp)` throws TypeError"
+);
+
+reportCompare(0, 0);