diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Map/prototype/forEach/first-argument-is-not-callable.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Map/prototype/forEach/first-argument-is-not-callable.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/first-argument-is-not-callable.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/first-argument-is-not-callable.js new file mode 100644 index 0000000000..c88ef521af --- /dev/null +++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/first-argument-is-not-callable.js @@ -0,0 +1,45 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-map.prototype.forEach +description: > + Throws a TypeError if first argument is not callable. +info: | + Map.prototype.forEach ( callbackfn [ , thisArg ] ) + + 4. If IsCallable(callbackfn) is false, throw a TypeError exception. + ... +features: [Symbol] +---*/ + +var map = new Map(); + +assert.throws(TypeError, function() { + map.forEach({}); +}); + +assert.throws(TypeError, function() { + map.forEach([]); +}); + +assert.throws(TypeError, function() { + map.forEach(1); +}); + +assert.throws(TypeError, function() { + map.forEach(''); +}); + +assert.throws(TypeError, function() { + map.forEach(null); +}); + +assert.throws(TypeError, function() { + map.forEach(undefined); +}); + +assert.throws(TypeError, function() { + map.forEach(Symbol()); +}); + +reportCompare(0, 0); |