aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/compress/reduce_vars.js64
1 files changed, 62 insertions, 2 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index d93f0cd1..a03bc1c8 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -1190,10 +1190,10 @@ defun_label: {
!function() {
console.log(function(a) {
L: {
- if (a) break L;
+ if (2) break L;
return 1;
}
- }(2));
+ }());
}();
}
expect_stdout: true
@@ -2894,3 +2894,63 @@ array_forin_2: {
}
expect_stdout: "3"
}
+
+const_expr_1: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ toplevel: true,
+ unsafe: true,
+ unused: true,
+ }
+ input: {
+ var o = {
+ a: 1,
+ b: 2
+ };
+ o.a++;
+ console.log(o.a, o.b);
+ }
+ expect: {
+ var o = {
+ a: 1,
+ b: 2
+ };
+ o.a++;
+ console.log(o.a, o.b);
+ }
+ expect_stdout: "2 2"
+}
+
+const_expr_2: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ toplevel: true,
+ unsafe: true,
+ unused: true,
+ }
+ input: {
+ Object.prototype.c = function() {
+ this.a++;
+ };
+ var o = {
+ a: 1,
+ b: 2
+ };
+ o.c();
+ console.log(o.a, o.b);
+ }
+ expect: {
+ Object.prototype.c = function() {
+ this.a++;
+ };
+ var o = {
+ a: 1,
+ b: 2
+ };
+ o.c();
+ console.log(o.a, o.b);
+ }
+ expect_stdout: "2 2"
+}