diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Iterator/prototype/filter/non-callable-predicate.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Iterator/prototype/filter/non-callable-predicate.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Iterator/prototype/filter/non-callable-predicate.js b/js/src/tests/test262/built-ins/Iterator/prototype/filter/non-callable-predicate.js new file mode 100644 index 0000000000..97960b7112 --- /dev/null +++ b/js/src/tests/test262/built-ins/Iterator/prototype/filter/non-callable-predicate.js @@ -0,0 +1,23 @@ +// |reftest| shell-option(--enable-iterator-helpers) skip-if(!this.hasOwnProperty('Iterator')||!xulRuntime.shell) -- iterator-helpers is not enabled unconditionally, requires shell-options +// Copyright (C) 2023 Michael Ficarra. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-iteratorprototype.filter +description: > + Iterator.prototype.filter expects to be called with a callable argument. +info: | + %Iterator.prototype%.filter ( predicate ) + + 2. If IsCallable(predicate) is false, throw a TypeError exception. + +features: [iterator-helpers] +flags: [] +---*/ +let nonCallable = {}; +let iterator = (function* () {})(); + +assert.throws(TypeError, function () { + iterator.filter(nonCallable); +}); + +reportCompare(0, 0); |