summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/for-of/array-iterator-empty.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/for-of/array-iterator-empty.js')
-rw-r--r--js/src/jit-test/tests/for-of/array-iterator-empty.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/for-of/array-iterator-empty.js b/js/src/jit-test/tests/for-of/array-iterator-empty.js
new file mode 100644
index 0000000000..5b448befae
--- /dev/null
+++ b/js/src/jit-test/tests/for-of/array-iterator-empty.js
@@ -0,0 +1,11 @@
+// Array.keys() and .entries() on an empty array produce empty iterators
+
+var arr = [];
+var ki = arr.keys(), ei = arr.entries();
+var p = Object.getPrototypeOf(ki);
+assertEq(Object.getPrototypeOf(ei), p);
+
+for (let k of ki)
+ throw "FAIL";
+for (let [k, v] of ei)
+ throw "FAIL";