Files
bun.sh/test/regression/issue/012039.test.ts
2024-09-03 21:32:52 -07:00

30 lines
714 B
TypeScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { expect, test } from "bun:test";
// Previously, this would crash due to the invalid property name
test("#12039 ZWJ", async () => {
const code = /*js*/ `
export default class {
W;
}
`;
expect(() => new Bun.Transpiler().transformSync(code)).not.toThrow();
});
test("#12039 ZWNJ", async () => {
const code = /*js*/ `
export default class {
W${String.fromCodePoint(0x200d)};
}
`;
expect(() => new Bun.Transpiler().transformSync(code)).not.toThrow();
});
test("#12039 invalid property name for identifier", async () => {
const code = /*js*/ `
export default class {
W${String.fromCodePoint(129)};
}
`;
expect(() => new Bun.Transpiler().transformSync(code)).toThrow(`Unexpected "W`);
});