summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.matchAll/string-tostring-throws.js
blob: 6592addd965ab3ee6804f9a17f3850b7881bbb7c (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
// Copyright (C) 2018 Jordan Harband. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: pending
description: String coercion of string parameter
info: |
  RegExp.prototype [ @@matchAll ] ( string )
    [...]
    3. Return ? MatchAllIterator(R, string).

  MatchAllIterator ( R, O )
    1. Let S be ? ToString(O).
features: [Symbol.matchAll]
---*/

var obj = {
  valueOf() {
    throw new Test262Error('This method should not be invoked.');
  },
  toString() {
    throw new Test262Error('toString invoked');
  }
};

assert.throws(Test262Error, function() {
  /toString value/[Symbol.matchAll](obj);
});

reportCompare(0, 0);