diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Array/prototype/flatMap/this-value-null-undefined-throws.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Array/prototype/flatMap/this-value-null-undefined-throws.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Array/prototype/flatMap/this-value-null-undefined-throws.js b/js/src/tests/test262/built-ins/Array/prototype/flatMap/this-value-null-undefined-throws.js new file mode 100644 index 0000000000..f2b52aeb34 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/flatMap/this-value-null-undefined-throws.js @@ -0,0 +1,27 @@ +// Copyright (C) 2018 Shilpi Jain and Michael Ficarra. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-array.prototype.flatMap +description: > + Throw a TypeError if this value is null or undefined +info: | + Array.prototype.flatMap ( mapperFunction [ , thisArg ] ) + + 1. Let O be ? ToObject(this value). + ... +features: [Array.prototype.flatMap] +---*/ + +assert.sameValue(typeof Array.prototype.flatMap, 'function'); + +var mapperFn = function() {}; + +assert.throws(TypeError, function() { + [].flatMap.call(null, mapperFn); +}, 'null value'); + +assert.throws(TypeError, function() { + [].flatMap.call(undefined, mapperFn); +}, 'undefined'); + +reportCompare(0, 0); |