summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExpStringIteratorPrototype/next/custom-regexpexec-not-callable.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/RegExpStringIteratorPrototype/next/custom-regexpexec-not-callable.js')
-rw-r--r--js/src/tests/test262/built-ins/RegExpStringIteratorPrototype/next/custom-regexpexec-not-callable.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExpStringIteratorPrototype/next/custom-regexpexec-not-callable.js b/js/src/tests/test262/built-ins/RegExpStringIteratorPrototype/next/custom-regexpexec-not-callable.js
new file mode 100644
index 0000000000..2f41827aa4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExpStringIteratorPrototype/next/custom-regexpexec-not-callable.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2018 Peter Wong. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: Behavior with a custom RegExp exec
+info: |
+ %RegExpStringIteratorPrototype%.next ( )
+ [...]
+ 9. Let match be ? RegExpExec(R, S).
+
+ Runtime Semantics: RegExpExec ( R, S )
+ 1. Assert: Type(R) is Object.
+ 2. Assert: Type(S) is String.
+ 3. Let exec be ? Get(R, "exec").
+ 4. If IsCallable(exec) is true, then
+ [...]
+ 5. If R does not have a [[RegExpMatcher]] internal slot, throw a
+ TypeError exception.
+ 6. Return ? RegExpBuiltinExec(R, S).
+features: [Symbol.matchAll]
+includes: [compareArray.js, compareIterator.js, regExpUtils.js]
+---*/
+
+function TestWithRegExpExec(exec) {
+ RegExp.prototype.exec = exec;
+
+ var regexp = /\w/g;
+ var str = 'a*b';
+
+ assert.compareIterator(regexp[Symbol.matchAll](str), [
+ matchValidator(['a'], 0, str),
+ matchValidator(['b'], 2, str)
+ ]);
+}
+
+TestWithRegExpExec(undefined);
+TestWithRegExpExec(null);
+TestWithRegExpExec(5);
+TestWithRegExpExec(true);
+TestWithRegExpExec(Symbol());
+
+reportCompare(0, 0);