aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-03-06 14:49:39 +0000
committerGitHub <noreply@github.com>2021-03-06 22:49:39 +0800
commitad903e924050067a96a33f2eb5a0b9ab3e5454c1 (patch)
tree4729dfc4dd369cf9bb8d8f8eed8c9b1e276cb5f1 /test
parent83c3838b07ed9ff32a83a39d5c1cbf40155c46f2 (diff)
downloadtracifyjs-ad903e924050067a96a33f2eb5a0b9ab3e5454c1.tar.gz
tracifyjs-ad903e924050067a96a33f2eb5a0b9ab3e5454c1.zip
fix corner cases with `export` (#4743)
fixes #4742
Diffstat (limited to 'test')
-rw-r--r--test/compress/exports.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/test/compress/exports.js b/test/compress/exports.js
index 2da1ee33..a7239148 100644
--- a/test/compress/exports.js
+++ b/test/compress/exports.js
@@ -382,3 +382,62 @@ single_use_class_default: {
A.prototype.p = "PASS";
}
}
+
+issue_4742_join_vars_1: {
+ options = {
+ join_vars: true,
+ }
+ input: {
+ var a = 42;
+ export var a;
+ }
+ expect: {
+ var a = 42;
+ export var a;
+ }
+}
+
+issue_4742_join_vars_2: {
+ options = {
+ join_vars: true,
+ }
+ input: {
+ export var a = "foo";
+ var b;
+ b = "bar";
+ }
+ expect: {
+ export var a = "foo";
+ var b, b = "bar";
+ }
+}
+
+issue_4742_unused_1: {
+ options = {
+ unused: true,
+ }
+ input: {
+ var a = 42;
+ export var a;
+ }
+ expect: {
+ var a = 42;
+ export var a;
+ }
+}
+
+issue_4742_unused_2: {
+ options = {
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ export var a = "foo";
+ var a = "bar";
+ }
+ expect: {
+ export var a = "foo";
+ a = "bar";
+ }
+}