summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/String/prototype/replaceAll/this-is-null-throws.js
blob: eb84d25c5b7b40b345c7067cf65e8eff2127b379 (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
31
32
// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-string.prototype.replaceall
description: >
  Throws TypeError when `this` is null
info: |
  String.prototype.replaceAll ( searchValue, replaceValue )

  1. Let O be RequireObjectCoercible(this value).
  ...

  RequireObjectCoercible ( argument )

  - Undefined: Throw a TypeError exception.
  - Null: Throw a TypeError exception.
features: [String.prototype.replaceAll]
---*/

assert.sameValue(
  typeof String.prototype.replaceAll,
  'function',
  'function must exist'
);

assert.throws(TypeError, function() {
  String.prototype.replaceAll.call(null);
});


reportCompare(0, 0);