Skip to content

Commit

Permalink
add utf8 test to bundler_compile & make test source ascii
Browse files Browse the repository at this point in the history
  • Loading branch information
pfgithub committed Mar 23, 2024
1 parent e99b886 commit 178f8fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 9 additions & 0 deletions test/bundler/bundler_compile.test.ts
Expand Up @@ -220,4 +220,13 @@ describe("bundler", () => {
},
run: { stdout: "Hello, world!", setCwd: true },
});
itBundled("compile/Utf8", {
compile: true,
files: {
"/entry.ts": /* js */ `
console.log(JSON.stringify({\u{6211}: "\u{6211}"}));
`,
},
run: { stdout: '{"\u{6211}":"\u{6211}"}' },
});
});
8 changes: 4 additions & 4 deletions test/regression/issue/09559.test.ts
Expand Up @@ -6,17 +6,17 @@ import { join } from "path";

test("bun build --target bun should support non-ascii source", async () => {
const files = {"index.js": `
console.log(JSON.stringify({: "a"}));
console.log(JSON.stringify({\u{6211}: "a"}));
const 我 = "b";
console.log(JSON.stringify({}));
console.log(JSON.stringify({\u{6211}}));
`};
const filenames = Object.keys(files);
const source = tempDirWithFiles("source", files);

$.throws(true);
await $`${bunExe()} build --target bun ${join(source, "index.js")} --outfile ${join(source, "bundle.js")}`;
const result = await $`${bunExe()} ${join(source, "bundle.js")}`.text();
expect(result).toBe(`{"":"a"}\n{"":"b"}\n`);

expect(result).toBe(`{"\u{6211}":"a"}\n{"\u{6211}":"b"}\n`);
})

0 comments on commit 178f8fe

Please sign in to comment.