diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-02-25 18:22:49 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-26 02:22:49 +0800 |
commit | 992952d8f6101ebefecf6ca5291d31290da8862f (patch) | |
tree | 1cc47b37f3bb06506f0773b69424eac33b4d30e5 /test/compress | |
parent | 6d7ab63a6600c65958f4788dee6da5b2ea43476c (diff) | |
download | tracifyjs-992952d8f6101ebefecf6ca5291d31290da8862f.tar.gz tracifyjs-992952d8f6101ebefecf6ca5291d31290da8862f.zip |
fix corner cases with `exports` (#4691)
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/exports.js | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/test/compress/exports.js b/test/compress/exports.js index e0690503..425b0245 100644 --- a/test/compress/exports.js +++ b/test/compress/exports.js @@ -227,3 +227,77 @@ keep_return_values: { } } } + +in_use: { + options = { + pure_getters: "strict", + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + export function f() {} + f.prototype.p = 42; + } + expect: { + export function f() {} + f.prototype.p = 42; + } +} + +in_use_default: { + options = { + pure_getters: "strict", + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + export default function f() {} + f.prototype.p = 42; + } + expect: { + export default function f() {} + f.prototype.p = 42; + } +} + +single_use: { + options = { + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + export function f() { + console.log("PASS"); + } + f(); + } + expect: { + export function f() { + console.log("PASS"); + } + f(); + } +} + +single_use_default: { + options = { + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + export default function f() { + console.log("PASS"); + } + f(); + } + expect: { + export default function f() { + console.log("PASS"); + } + f(); + } +} |