This commit is contained in:
Dylan Conway
2023-10-30 16:09:34 -07:00
parent 4d780837ac
commit 7e09c7ca1e

View File

@@ -7,24 +7,24 @@ import { tmpdir } from "os";
import { join } from "path";
it("macros should not lead to seg faults under any given input", async () => {
// this test code follows the same structure as and
// is based on the code for testing issue 4893
// this test code follows the same structure as and
// is based on the code for testing issue 4893
const testDir = mkdtempSync(join(tmpdir(), "issue3830-"));
const testDir = mkdtempSync(join(tmpdir(), "issue3830-"));
// Clean up from prior runs if necessary
rmSync(testDir, { recursive: true, force: true });
// Clean up from prior runs if necessary
rmSync(testDir, { recursive: true, force: true });
// Create a directory with our test file
mkdirSync(testDir, { recursive: true });
writeFileSync(join(testDir, "macro.ts"), 'export function fn(str) { return str; }');
writeFileSync(join(testDir, "index.ts"), "import { fn } from './macro' assert { type: 'macro' };\nfn(`©${''}`);");
// Create a directory with our test file
mkdirSync(testDir, { recursive: true });
writeFileSync(join(testDir, "macro.ts"), "export function fn(str) { return str; }");
writeFileSync(join(testDir, "index.ts"), "import { fn } from './macro' assert { type: 'macro' };\nfn(`©${''}`);");
const { stdout, exitCode } = Bun.spawnSync({
cmd: [bunExe(), "build", join(testDir, "index.ts")],
env: bunEnv,
stderr: "inherit",
});
const { stdout, exitCode } = Bun.spawnSync({
cmd: [bunExe(), "build", join(testDir, "index.ts")],
env: bunEnv,
stderr: "inherit",
});
expect(exitCode).toBe(0);
});
expect(exitCode).toBe(0);
});