aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-06-25 14:21:48 +0800
committerGitHub <noreply@github.com>2017-06-25 14:21:48 +0800
commit285401ced889dcbc24c7431ae299bfbe328c5df5 (patch)
tree5a3c0e2cca6223a8a04263887889b38b8e1ee8d2
parent9db4c42380ff409b6be933083b92311522679988 (diff)
downloadtracifyjs-285401ced889dcbc24c7431ae299bfbe328c5df5.tar.gz
tracifyjs-285401ced889dcbc24c7431ae299bfbe328c5df5.zip
more tests for #2158 (#2160)
-rw-r--r--test/compress/pure_getters.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/test/compress/pure_getters.js b/test/compress/pure_getters.js
index 2e7e17dc..dc56e19d 100644
--- a/test/compress/pure_getters.js
+++ b/test/compress/pure_getters.js
@@ -288,6 +288,56 @@ set_immutable_2: {
expect_stdout: "PASS"
}
+set_immutable_3: {
+ options = {
+ collapse_vars: true,
+ evaluate: true,
+ pure_getters: "strict",
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ "use strict";
+ var a = 1;
+ a.foo += "";
+ if (a.foo) console.log("FAIL");
+ else console.log("PASS");
+ }
+ expect: {
+ "use strict";
+ 1..foo += "";
+ if (1..foo) console.log("FAIL");
+ else console.log("PASS");
+ }
+ expect_stdout: true
+}
+
+set_immutable_4: {
+ options = {
+ cascade: true,
+ conditionals: true,
+ pure_getters: "strict",
+ reduce_vars: true,
+ sequences: true,
+ side_effects: true,
+ toplevel: true,
+ }
+ input: {
+ "use strict";
+ var a = 1;
+ a.foo += "";
+ if (a.foo) console.log("FAIL");
+ else console.log("PASS");
+ }
+ expect: {
+ "use strict";
+ var a = 1;
+ a.foo += "", a.foo ? console.log("FAIL") : console.log("PASS");
+ }
+ expect_stdout: true
+}
+
set_mutable_1: {
options = {
collapse_vars: true,