summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Tuple/from/iter-set-length.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/non262/Tuple/from/iter-set-length.js')
-rw-r--r--js/src/tests/non262/Tuple/from/iter-set-length.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/js/src/tests/non262/Tuple/from/iter-set-length.js b/js/src/tests/non262/Tuple/from/iter-set-length.js
new file mode 100644
index 0000000000..8515ea2bd9
--- /dev/null
+++ b/js/src/tests/non262/Tuple/from/iter-set-length.js
@@ -0,0 +1,31 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+var items = {};
+var result, nextIterResult, lastIterResult;
+items[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ var result = nextIterResult;
+ nextIterResult = lastIterResult;
+ return result;
+ }
+ };
+};
+
+nextIterResult = lastIterResult = {
+ done: true
+};
+result = Tuple.from(items);
+
+assertEq(result.length, 0);
+
+nextIterResult = {
+ done: false
+};
+lastIterResult = {
+ done: true
+};
+result = Tuple.from(items);
+
+assertEq(result.length, 1);
+
+reportCompare(0, 0);