summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExpStringIteratorPrototype/next/custom-regexpexec-call-throws.js
blob: 4358d95c29a912f6f36095b5ad9cd1cbbd8f9174 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (C) 2018 Peter Wong. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: pending
description: Re-throws errors when calling 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
      a. Let result be ? Call(exec, R, « S »).
features: [Symbol.matchAll]
---*/

var iter = /./[Symbol.matchAll]('');

RegExp.prototype.exec = function() {
  throw new Test262Error();
};

assert.throws(Test262Error, function() {
  iter.next();
});

reportCompare(0, 0);