diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Array/prototype/with/this-value-nullish.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Array/prototype/with/this-value-nullish.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Array/prototype/with/this-value-nullish.js b/js/src/tests/test262/built-ins/Array/prototype/with/this-value-nullish.js new file mode 100644 index 0000000000..befef0642d --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/with/this-value-nullish.js @@ -0,0 +1,24 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.with +description: > + Array.prototype.with throws if the receiver is null or undefined +info: | + Array.prototype.with ( index, value ) + + 1. Let O be ? ToObject(this value). + ... +features: [change-array-by-copy] +---*/ + +assert.throws(TypeError, () => { + Array.prototype.with.call(null, 0, 0); +}, '`Array.prototype.with.call(null, 0, 0)` throws TypeError'); + +assert.throws(TypeError, () => { + Array.prototype.with.call(undefined, 0, 0); +}, '`Array.prototype.with.call(undefined, 0, 0)` throws TypeError'); + +reportCompare(0, 0); |