aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-11-21 00:05:40 +0000
committerGitHub <noreply@github.com>2020-11-21 08:05:40 +0800
commit8d30902ba9e8a08945c8ae7cac0cb2feb27bb93c (patch)
tree9ba07d329d8996dac374700afe7195efd7946827 /test
parent02459cddf98428427dd1b089cbb469f465cd5b3b (diff)
downloadtracifyjs-8d30902ba9e8a08945c8ae7cac0cb2feb27bb93c.tar.gz
tracifyjs-8d30902ba9e8a08945c8ae7cac0cb2feb27bb93c.zip
fix corner case in `mangle` (#4311)
Diffstat (limited to 'test')
-rw-r--r--test/compress/const.js46
1 files changed, 44 insertions, 2 deletions
diff --git a/test/compress/const.js b/test/compress/const.js
index 8dbe74da..c269f8c0 100644
--- a/test/compress/const.js
+++ b/test/compress/const.js
@@ -1,3 +1,45 @@
+mangle_block: {
+ mangle = {
+ toplevel: false,
+ }
+ input: {
+ var o = "PASS";
+ {
+ const a = "FAIL";
+ }
+ console.log(o);
+ }
+ expect: {
+ var o = "PASS";
+ {
+ const a = "FAIL";
+ }
+ console.log(o);
+ }
+ expect_stdout: "PASS"
+}
+
+mangle_block_toplevel: {
+ mangle = {
+ toplevel: true,
+ }
+ input: {
+ var o = "PASS";
+ {
+ const a = "FAIL";
+ }
+ console.log(o);
+ }
+ expect: {
+ var o = "PASS";
+ {
+ const c = "FAIL";
+ }
+ console.log(o);
+ }
+ expect_stdout: "PASS"
+}
+
mangle_catch_1: {
mangle = {}
input: {
@@ -11,8 +53,8 @@ mangle_catch_1: {
expect: {
try {
throw "eeeee";
- } catch (e) {
- const o = typeof d;
+ } catch (o) {
+ const e = typeof d;
}
console.log(typeof a, typeof b);
}