diff options
Diffstat (limited to '')
-rw-r--r-- | js/src/tests/test262/built-ins/String/prototype/replaceAll/this-is-undefined-throws.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/String/prototype/replaceAll/this-is-undefined-throws.js b/js/src/tests/test262/built-ins/String/prototype/replaceAll/this-is-undefined-throws.js new file mode 100644 index 0000000000..eadce773df --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/replaceAll/this-is-undefined-throws.js @@ -0,0 +1,31 @@ +// 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 undefined +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(undefined); +}); + +reportCompare(0, 0); |