aboutsummaryrefslogtreecommitdiff
path: root/integration/snippets
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-09-22 02:16:31 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-09-22 02:16:31 -0700
commit8f460a9be3d954d6be555d1bcd382383d23d9280 (patch)
tree4a64f0164554c99af419564a4e4885d27d09deff /integration/snippets
parent204b07f46b6c8985c8928ec58b51d941903ad69b (diff)
downloadbun-8f460a9be3d954d6be555d1bcd382383d23d9280.tar.gz
bun-8f460a9be3d954d6be555d1bcd382383d23d9280.tar.zst
bun-8f460a9be3d954d6be555d1bcd382383d23d9280.zip
Fix parsing bug with arrays that have default values
Diffstat (limited to 'integration/snippets')
-rw-r--r--integration/snippets/array-args-with-default-values.js28
-rw-r--r--integration/snippets/package-json-exports/index.js4
2 files changed, 31 insertions, 1 deletions
diff --git a/integration/snippets/array-args-with-default-values.js b/integration/snippets/array-args-with-default-values.js
new file mode 100644
index 000000000..f733a1bfa
--- /dev/null
+++ b/integration/snippets/array-args-with-default-values.js
@@ -0,0 +1,28 @@
+var lines;
+const data = () =>
+ lines.map(([a = null, b = null, c = null, d = null]) => ({
+ a,
+ b,
+ c,
+ d,
+ }));
+
+export function test() {
+ let ran = false;
+ lines = [
+ [undefined, undefined, undefined, undefined],
+ [undefined, undefined, undefined, undefined],
+ [undefined, undefined, undefined, undefined],
+ [undefined, undefined, undefined, undefined],
+ ];
+
+ for (let foo of data()) {
+ console.assert(foo.a === null);
+ console.assert(foo.b === null);
+ console.assert(foo.c === null);
+ console.assert(foo.d === null);
+ ran = true;
+ }
+ console.assert(ran);
+ testDone(import.meta.url);
+}
diff --git a/integration/snippets/package-json-exports/index.js b/integration/snippets/package-json-exports/index.js
index 7603e0d59..7573e431c 100644
--- a/integration/snippets/package-json-exports/index.js
+++ b/integration/snippets/package-json-exports/index.js
@@ -2,9 +2,11 @@ import * as InexactRoot from "inexact";
import * as InexactFile from "inexact/file";
import * as ExactFile from "inexact/foo";
-export function test() {
+export async function test() {
console.assert(InexactRoot.target === "browser");
console.assert(InexactFile.target === "browser");
console.assert(ExactFile.target === "browser");
+
+ console.assert(failed);
return testDone(import.meta.url);
}