test case for utf-16 change

This commit is contained in:
pfg
2025-07-24 15:05:33 -07:00
parent 87521761e7
commit 6528bb9166
2 changed files with 17 additions and 2 deletions

View File

@@ -12,7 +12,8 @@
/// Version 13: Hoist `import.meta.require` definition, see #15738
/// Version 14: Updated global defines table list.
/// Version 15: Updated global defines table list.
const expected_version = 15;
/// Version 16: Emojis in strings are preserved in unicode output (node/web)
const expected_version = 16;
const debug = Output.scoped(.cache, false);
const MINIMUM_CACHE_SIZE = 50 * 1024;

View File

@@ -1,4 +1,4 @@
import { describe } from "bun:test";
import { describe, expect } from "bun:test";
import { dedent, itBundled } from "./expectBundled";
interface TemplateStringTest {
@@ -89,6 +89,20 @@ const templateStringTests: Record<string, TemplateStringTest> = {
};
describe("bundler", () => {
// Test for emoji output in bun build
itBundled("string/EmojiDirectOutput", {
files: {
"a.js": `console.log("😀");`,
},
outfile: "out.js",
onAfterBundle(api) {
const content = api.readFile("out.js");
expect(content).toContain("😀");
expect(content).not.toContain("\\ud83d");
expect(content).not.toContain("\\ude00");
},
});
for (const key in templateStringTests) {
const test = templateStringTests[key];
if ([test.capture, test.captureRaw, test.print].filter(x => x !== undefined).length !== 1) {