summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/collections/Map-constructor-generator-1.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/collections/Map-constructor-generator-1.js')
-rw-r--r--js/src/jit-test/tests/collections/Map-constructor-generator-1.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/collections/Map-constructor-generator-1.js b/js/src/jit-test/tests/collections/Map-constructor-generator-1.js
new file mode 100644
index 000000000..61a319846
--- /dev/null
+++ b/js/src/jit-test/tests/collections/Map-constructor-generator-1.js
@@ -0,0 +1,19 @@
+// The argument to Map can be a generator.
+
+var done = false;
+function data(n) {
+ var s = '';
+ for (var i = 0; i < n; i++) {
+ yield [s, i];
+ s += '.';
+ }
+ done = true;
+}
+
+var m = new Map(data(50));
+assertEq(done, true); // the constructor consumes the argument
+assertEq(m.size, 50);
+assertEq(m.get(""), 0);
+assertEq(m.get("....."), 5);
+assertEq(m.get(Array(49+1).join(".")), 49);
+assertEq(m.has(undefined), false);