summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/String/prototype/split/valueOf-is-called-for-limit-argument.js
blob: 9e9b71d43eeed417d431cac74e8388ef0729dc11 (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
// Copyright (C) 2020 Rick Waldron.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-string.prototype.split
description: >
  Calls valueOf() of limit argument
info: |
  String.prototype.split(separator, limit):

  If limit is undefined, let lim be 232 - 1; else let lim be ℝ(? ToUint32(limit)).
features: [arrow-function]
---*/


let limit = {
  toString() {},
  valueOf() {
    throw new Test262Error();
  }
};

assert.throws(Test262Error, () => {
  "".split("", limit);
});

reportCompare(0, 0);