diff --git a/crates/oxc_minifier/tests/mangler/mod.rs b/crates/oxc_minifier/tests/mangler/mod.rs index e8a1001d42d76..3d76bed459fca 100644 --- a/crates/oxc_minifier/tests/mangler/mod.rs +++ b/crates/oxc_minifier/tests/mangler/mod.rs @@ -26,7 +26,13 @@ fn mangler() { "import { x } from 's'; export { x }", "function _ (exports) { Object.defineProperty(exports, '__esModule', { value: true }) }", ]; - let top_level_cases = ["function foo(a) {a}"]; + let top_level_cases = [ + "function foo(a) {a}", + "export function foo() {}; foo()", + "export default function foo() {}; foo()", + "export const foo = 1; foo", + "const foo = 1; foo; export { foo }", + ]; let mut snapshot = String::new(); cases.into_iter().fold(&mut snapshot, |w, case| { diff --git a/crates/oxc_minifier/tests/mangler/snapshots/mangler.snap b/crates/oxc_minifier/tests/mangler/snapshots/mangler.snap index fd36999045d8d..526aebb772f14 100644 --- a/crates/oxc_minifier/tests/mangler/snapshots/mangler.snap +++ b/crates/oxc_minifier/tests/mangler/snapshots/mangler.snap @@ -35,3 +35,24 @@ function foo(a) {a} function a(b) { b; } + +export function foo() {}; foo() +function a() {} +; +a(); +export { a as foo }; + +export default function foo() {}; foo() +export default function a() {} +; +a(); + +export const foo = 1; foo +export const a = 1; +a; +export { a as foo }; + +const foo = 1; foo; export { foo } +const a = 1; +a; +export { a as foo };