From 07e695da031ae9638684e6f1bd2e4e29ca14d098 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Mon, 16 May 2022 23:05:21 -0700 Subject: add a test --- integration/bunjs-only-snippets/transpiler.test.js | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'integration/bunjs-only-snippets/transpiler.test.js') diff --git a/integration/bunjs-only-snippets/transpiler.test.js b/integration/bunjs-only-snippets/transpiler.test.js index 61024e400..dd0ffdc8f 100644 --- a/integration/bunjs-only-snippets/transpiler.test.js +++ b/integration/bunjs-only-snippets/transpiler.test.js @@ -132,6 +132,9 @@ describe("Bun.Transpiler", () => { }, platform: "bun", macro: { + inline: { + whatDidIPass: `${import.meta.dir}/inline.macro.js`, + }, react: { bacon: `${import.meta.dir}/macro-check.js`, }, @@ -618,6 +621,35 @@ describe("Bun.Transpiler", () => { expectBunPrinted_("export const foo = 1 * 2", "export const foo = 2"); }); + it("pass objects to macros", () => { + var object = { + helloooooooo: { + message: [12345], + }, + }; + + const output = bunTranspiler.transformSync( + ` + import {whatDidIPass} from 'inline'; + + export function foo() { + return whatDidIPass(); + } + `, + object + ); + expect(output).toBe(`export function foo() { + return { + helloooooooo: { + message: [ + 12345 + ] + } + }; +} +`); + }); + it("rewrite string to length", () => { expectPrinted_( `export const foo = "a".length + "b".length;`, -- cgit v1.2.3