summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/arrays/from-async-oom.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/arrays/from-async-oom.js')
-rw-r--r--js/src/jit-test/tests/arrays/from-async-oom.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/arrays/from-async-oom.js b/js/src/jit-test/tests/arrays/from-async-oom.js
new file mode 100644
index 0000000000..a68fd33299
--- /dev/null
+++ b/js/src/jit-test/tests/arrays/from-async-oom.js
@@ -0,0 +1,26 @@
+// |jit-test| skip-if: !('oomTest' in this)
+
+// Basic Smoke Test
+async function* asyncGen(n) {
+ for (let i = 0; i < n; i++) {
+ yield i * 2;
+ }
+}
+
+function test() {
+ Array.fromAsync(asyncGen(4)).then((x) => {
+ assertEq(Array.isArray(x), true);
+ assertEq(x.length, 4);
+ assertEq(x[0], 0);
+ assertEq(x[1], 2);
+ assertEq(x[2], 4);
+ assertEq(x[3], 6);
+ done = true;
+ }
+ );
+
+ drainJobQueue();
+}
+
+oomTest(test);
+