aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-05-29 10:51:41 +0800
committerGitHub <noreply@github.com>2017-05-29 10:51:41 +0800
commit1aa38051fbf0bde7071041f6ac37e666aecb4c0a (patch)
treee33bc9bb34021b429c2a4edcafe4dcfd596cc74c /test
parente62b879b488f40acd4e7e95d70c53a91c45810ed (diff)
downloadtracifyjs-1aa38051fbf0bde7071041f6ac37e666aecb4c0a.tar.gz
tracifyjs-1aa38051fbf0bde7071041f6ac37e666aecb4c0a.zip
better fix for #512 & #2010 (#2019)
- remove duplicated functionalities - fix similar issue with `else`
Diffstat (limited to 'test')
-rw-r--r--test/compress/if_return.js2
-rw-r--r--test/compress/issue-1052.js24
2 files changed, 25 insertions, 1 deletions
diff --git a/test/compress/if_return.js b/test/compress/if_return.js
index c09d67b6..72b69e70 100644
--- a/test/compress/if_return.js
+++ b/test/compress/if_return.js
@@ -307,6 +307,8 @@ issue_512: {
options = {
conditionals: true,
if_return: true,
+ sequences: true,
+ side_effects: true,
}
input: {
function a() {
diff --git a/test/compress/issue-1052.js b/test/compress/issue-1052.js
index e3dc7322..30a563fe 100644
--- a/test/compress/issue-1052.js
+++ b/test/compress/issue-1052.js
@@ -136,7 +136,29 @@ defun_hoist_funs: {
function f() {}
function g() {}
function h() {}
- !window;
+ if (window);
+ }
+ }
+}
+
+defun_else_if_return: {
+ options = {
+ hoist_funs: false,
+ if_return: true,
+ }
+ input: {
+ function e() {
+ function f() {}
+ if (window) function g() {}
+ else return;
+ function h() {}
+ }
+ }
+ expect: {
+ function e() {
+ function f() {}
+ if (window) function g() {}
+ function h() {}
}
}
}