summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Iterator/from/modify-next.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/non262/Iterator/from/modify-next.js')
-rw-r--r--js/src/tests/non262/Iterator/from/modify-next.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/js/src/tests/non262/Iterator/from/modify-next.js b/js/src/tests/non262/Iterator/from/modify-next.js
new file mode 100644
index 0000000000..d347abd2cd
--- /dev/null
+++ b/js/src/tests/non262/Iterator/from/modify-next.js
@@ -0,0 +1,15 @@
+// |reftest| skip-if(!this.hasOwnProperty('Iterator')) -- Iterator is not enabled unconditionally
+const iter = {
+ next: () => ({ done: false, value: 0 }),
+};
+
+const wrap = Iterator.from(iter);
+
+iter.next = () => ({ done: true, value: undefined });
+
+let {done, value} = wrap.next();
+assertEq(done, false);
+assertEq(value, 0);
+
+if (typeof reportCompare === 'function')
+ reportCompare(0, 0);