aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-02-26 20:56:34 +0000
committerGitHub <noreply@github.com>2021-02-27 04:56:34 +0800
commitba4a771bbccb0b6026588a56b0c31f5bac466775 (patch)
tree4ff73f772c92a86328ca59d022b0ccec840c3d6e /test/compress
parentac26993b5a1546e790d93603d0d7a05740566b07 (diff)
downloadtracifyjs-ba4a771bbccb0b6026588a56b0c31f5bac466775.tar.gz
tracifyjs-ba4a771bbccb0b6026588a56b0c31f5bac466775.zip
support limited `ufuzz` testing for `export` (#4693)
fixes #4692
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/exports.js60
1 files changed, 60 insertions, 0 deletions
diff --git a/test/compress/exports.js b/test/compress/exports.js
index 425b0245..c573223d 100644
--- a/test/compress/exports.js
+++ b/test/compress/exports.js
@@ -56,6 +56,20 @@ defaults_parentheses_2: {
expect_exact: 'export default(async function(){console.log("PASS")})();'
}
+defaults_parentheses_3: {
+ input: {
+ export default (42, "PASS");
+ }
+ expect_exact: 'export default(42,"PASS");'
+}
+
+defaults_parentheses_4: {
+ input: {
+ export default (function f() {});
+ }
+ expect_exact: "export default(function f(){});"
+}
+
foreign: {
input: {
export * from "foo";
@@ -203,6 +217,20 @@ hoist_exports: {
}
}
+hoist_vars: {
+ options = {
+ hoist_vars: true,
+ }
+ input: {
+ var a;
+ export var b = 42;
+ }
+ expect: {
+ var a;
+ export var b = 42;
+ }
+}
+
keep_return_values: {
options = {
booleans: true,
@@ -301,3 +329,35 @@ single_use_default: {
f();
}
}
+
+single_use_class: {
+ options = {
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ export class A {}
+ A.prototype.p = "PASS";
+ }
+ expect: {
+ export class A {}
+ A.prototype.p = "PASS";
+ }
+}
+
+single_use_class_default: {
+ options = {
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ export default class A {}
+ A.prototype.p = "PASS";
+ }
+ expect: {
+ export default class A {}
+ A.prototype.p = "PASS";
+ }
+}