aboutsummaryrefslogtreecommitdiff
path: root/test/compress/evaluate.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-11-13 04:17:09 +0800
committerGitHub <noreply@github.com>2019-11-13 04:17:09 +0800
commitd6fd18d0b000e1e4fbe01259139043f42d8fdebf (patch)
tree7dca39ef5d97e53a4e5c1d062565df3d9313373f /test/compress/evaluate.js
parent0d17c5b0fa3a4305177f9561ba1f05835a9ffea3 (diff)
downloadtracifyjs-d6fd18d0b000e1e4fbe01259139043f42d8fdebf.tar.gz
tracifyjs-d6fd18d0b000e1e4fbe01259139043f42d8fdebf.zip
enhance `evaluate` & `inline` (#3580)
Diffstat (limited to 'test/compress/evaluate.js')
-rw-r--r--test/compress/evaluate.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js
index 74cb65ff..ea707e63 100644
--- a/test/compress/evaluate.js
+++ b/test/compress/evaluate.js
@@ -1900,3 +1900,24 @@ issue_3568: {
}
expect_stdout: "NaN"
}
+
+conditional_function: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ toplevel: true,
+ }
+ input: {
+ function f(a) {
+ return a && "undefined" != typeof A ? A : 42;
+ }
+ console.log(f(0), f(1));
+ }
+ expect: {
+ function f(a) {
+ return a && "undefined" != typeof A ? A : 42;
+ }
+ console.log(42, f(1));
+ }
+ expect_stdout: "42 42"
+}