aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-11-01 02:08:31 +0800
committerGitHub <noreply@github.com>2019-11-01 02:08:31 +0800
commit815eff1f7c5c2fca63814f11fbf6e769bc599e38 (patch)
tree274816aa217047b35ef08163330e77ed8e410a54 /test
parent1e9b576ee9938d6acb9dff277474e9a32f866690 (diff)
downloadtracifyjs-815eff1f7c5c2fca63814f11fbf6e769bc599e38.tar.gz
tracifyjs-815eff1f7c5c2fca63814f11fbf6e769bc599e38.zip
enhance `if_return` (#3560)
Diffstat (limited to 'test')
-rw-r--r--test/compress/typeof.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/compress/typeof.js b/test/compress/typeof.js
index c3c2e9ec..3b99521e 100644
--- a/test/compress/typeof.js
+++ b/test/compress/typeof.js
@@ -409,3 +409,31 @@ typeof_defined_4: {
"object" != typeof A || "object" == typeof B || B;
}
}
+
+emberjs_global: {
+ options = {
+ comparisons: true,
+ conditionals: true,
+ if_return: true,
+ passes: 2,
+ side_effects: true,
+ toplevel: true,
+ typeofs: true,
+ unused: true,
+ }
+ input: {
+ var a;
+ if (typeof A === "object") {
+ a = A;
+ } else if (typeof B === "object") {
+ a = B;
+ } else {
+ throw new Error("PASS");
+ }
+ }
+ expect: {
+ if ("object" != typeof A && "object" != typeof B)
+ throw new Error("PASS");
+ }
+ expect_stdout: Error("PASS")
+}