summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Iterator/prototype/lazy-methods-throw-eagerly-on-next-non-callable.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/non262/Iterator/prototype/lazy-methods-throw-eagerly-on-next-non-callable.js')
-rw-r--r--js/src/tests/non262/Iterator/prototype/lazy-methods-throw-eagerly-on-next-non-callable.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/js/src/tests/non262/Iterator/prototype/lazy-methods-throw-eagerly-on-next-non-callable.js b/js/src/tests/non262/Iterator/prototype/lazy-methods-throw-eagerly-on-next-non-callable.js
new file mode 100644
index 0000000000..35dd627acf
--- /dev/null
+++ b/js/src/tests/non262/Iterator/prototype/lazy-methods-throw-eagerly-on-next-non-callable.js
@@ -0,0 +1,33 @@
+// |reftest| skip-if(!this.hasOwnProperty('Iterator'))
+
+//
+//
+/*---
+esid: pending
+description: Lazy %Iterator.prototype% methods don't throw when `next` is non-callable.
+info: >
+ Iterator Helpers proposal 1.1.1
+features: [iterator-helpers]
+---*/
+
+const methods = [
+ next => Iterator.prototype.map.bind({next}, x => x),
+ next => Iterator.prototype.filter.bind({next}, x => x),
+ next => Iterator.prototype.take.bind({next}, 1),
+ next => Iterator.prototype.drop.bind({next}, 0),
+ next => Iterator.prototype.flatMap.bind({next}, x => [x]),
+];
+
+for (const method of methods) {
+ method(0);
+ method(false);
+ method(undefined);
+ method(null);
+ method('');
+ method(Symbol(''));
+ method({});
+ method([]);
+}
+
+if (typeof reportCompare == 'function')
+ reportCompare(0, 0);