move & add

This commit is contained in:
pfg
2025-07-15 20:19:05 -07:00
parent f093751e9b
commit 678bf0c3fb
3 changed files with 31 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
console.log("--- begin ---");
console.log({
a: "a",
multiline: 'pub fn main() !void {\n std.log.info("Hello, {s}", .{name});\n}',
});
console.log("--- end ---");

View File

@@ -0,0 +1,25 @@
import { test, expect } from "bun:test";
import { bunExe } from "harness";
test("console.log output", async () => {
const result = Bun.spawn({
cmd: [bunExe(), import.meta.dir + "/consolelog.fixture.ts"],
stdio: ["inherit", "pipe", "pipe"],
});
await result.exited;
const stdout = await result.stdout.text();
const stderr = await result.stderr.text();
expect(stderr).toBe("");
expect(result.exitCode).toBe(0);
expect(stdout).toMatchInlineSnapshot(`
"--- begin ---
{
a: a,
multiline: "pub fn main() !void {
std.log.info(\\"Hello, {s}\\", .{name});
}",
}
--- end ---
"
`);
});