aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/issue-1321.js38
-rw-r--r--test/compress/issue-1770.js12
-rw-r--r--test/compress/issue-747.js12
-rw-r--r--test/compress/properties.js88
4 files changed, 98 insertions, 52 deletions
diff --git a/test/compress/issue-1321.js b/test/compress/issue-1321.js
index 6b92291d..e55696d0 100644
--- a/test/compress/issue-1321.js
+++ b/test/compress/issue-1321.js
@@ -1,6 +1,8 @@
issue_1321_no_debug: {
- mangle_props = {
- keep_quoted: true
+ mangle = {
+ properties: {
+ keep_quoted: true,
+ },
}
input: {
var x = {};
@@ -10,17 +12,19 @@ issue_1321_no_debug: {
}
expect: {
var x = {};
- x.o = 1;
- x["a"] = 2 * x.o;
- console.log(x.o, x["a"]);
+ x.x = 1;
+ x["a"] = 2 * x.x;
+ console.log(x.x, x["a"]);
}
expect_stdout: true
}
issue_1321_debug: {
- mangle_props = {
- keep_quoted: true,
- debug: ""
+ mangle = {
+ properties: {
+ debug: "",
+ keep_quoted: true,
+ },
}
input: {
var x = {};
@@ -30,16 +34,18 @@ issue_1321_debug: {
}
expect: {
var x = {};
- x.o = 1;
- x["_$foo$_"] = 2 * x.o;
- console.log(x.o, x["_$foo$_"]);
+ x.x = 1;
+ x["_$foo$_"] = 2 * x.x;
+ console.log(x.x, x["_$foo$_"]);
}
expect_stdout: true
}
issue_1321_with_quoted: {
- mangle_props = {
- keep_quoted: false
+ mangle = {
+ properties: {
+ keep_quoted: false,
+ },
}
input: {
var x = {};
@@ -49,9 +55,9 @@ issue_1321_with_quoted: {
}
expect: {
var x = {};
- x.o = 1;
- x["x"] = 2 * x.o;
- console.log(x.o, x["x"]);
+ x.x = 1;
+ x["o"] = 2 * x.x;
+ console.log(x.x, x["o"]);
}
expect_stdout: true
}
diff --git a/test/compress/issue-1770.js b/test/compress/issue-1770.js
index f296a403..f63f8453 100644
--- a/test/compress/issue-1770.js
+++ b/test/compress/issue-1770.js
@@ -1,5 +1,7 @@
mangle_props: {
- mangle_props = {}
+ mangle = {
+ properties: true,
+ }
input: {
var obj = {
undefined: 1,
@@ -54,10 +56,12 @@ mangle_props: {
}
numeric_literal: {
+ mangle = {
+ properties: true,
+ }
beautify = {
beautify: true,
}
- mangle_props = {}
input: {
var obj = {
0: 0,
@@ -105,7 +109,9 @@ numeric_literal: {
}
identifier: {
- mangle_props = {}
+ mangle = {
+ properties: true,
+ }
input: {
var obj = {
abstract: 1,
diff --git a/test/compress/issue-747.js b/test/compress/issue-747.js
index 1f7079c2..e074305a 100644
--- a/test/compress/issue-747.js
+++ b/test/compress/issue-747.js
@@ -1,6 +1,8 @@
dont_reuse_prop: {
- mangle_props = {
- regex: /asd/
+ mangle = {
+ properties: {
+ regex: /asd/,
+ },
}
input: {
"aaaaaaaaaabbbbb";
@@ -20,8 +22,10 @@ dont_reuse_prop: {
}
unmangleable_props_should_always_be_reserved: {
- mangle_props = {
- regex: /asd/
+ mangle = {
+ properties: {
+ regex: /asd/,
+ },
}
input: {
"aaaaaaaaaabbbbb";
diff --git a/test/compress/properties.js b/test/compress/properties.js
index dda2e74f..c2c43f69 100644
--- a/test/compress/properties.js
+++ b/test/compress/properties.js
@@ -128,9 +128,11 @@ evaluate_string_length: {
}
mangle_properties: {
- mangle_props = {
- keep_quoted: false
- };
+ mangle = {
+ properties: {
+ keep_quoted: false,
+ },
+ }
input: {
a["foo"] = "bar";
a.color = "red";
@@ -139,11 +141,11 @@ mangle_properties: {
a['run']({color: "blue", foo: "baz"});
}
expect: {
- a["o"] = "bar";
- a.a = "red";
- x = {r: 10};
- a.b(x.r, a.o);
- a['b']({a: "blue", o: "baz"});
+ a["a"] = "bar";
+ a.b = "red";
+ x = {o: 10};
+ a.r(x.o, a.a);
+ a['r']({b: "blue", a: "baz"});
}
}
@@ -151,8 +153,10 @@ mangle_unquoted_properties: {
options = {
properties: false
}
- mangle_props = {
- keep_quoted: true
+ mangle = {
+ properties: {
+ keep_quoted: true,
+ },
}
beautify = {
beautify: false,
@@ -181,24 +185,26 @@ mangle_unquoted_properties: {
function f1() {
a["foo"] = "bar";
a.color = "red";
- a.o = 2;
- x = {"bar": 10, f: 7};
- a.f = 9;
+ a.r = 2;
+ x = {"bar": 10, b: 7};
+ a.b = 9;
}
function f2() {
a.foo = "bar";
a['color'] = "red";
- x = {bar: 10, f: 7};
- a.f = 9;
- a.o = 3;
+ x = {bar: 10, b: 7};
+ a.b = 9;
+ a.r = 3;
}
}
}
mangle_debug: {
- mangle_props = {
- debug: ""
- };
+ mangle = {
+ properties: {
+ debug: "",
+ },
+ }
input: {
a.foo = "bar";
x = { baz: "ban" };
@@ -210,9 +216,11 @@ mangle_debug: {
}
mangle_debug_true: {
- mangle_props = {
- debug: true
- };
+ mangle = {
+ properties: {
+ debug: true,
+ },
+ }
input: {
a.foo = "bar";
x = { baz: "ban" };
@@ -224,9 +232,11 @@ mangle_debug_true: {
}
mangle_debug_suffix: {
- mangle_props = {
- debug: "XYZ"
- };
+ mangle = {
+ properties: {
+ debug: "XYZ",
+ },
+ }
input: {
a.foo = "bar";
x = { baz: "ban" };
@@ -241,10 +251,12 @@ mangle_debug_suffix_keep_quoted: {
options = {
properties: false
}
- mangle_props = {
- keep_quoted: true,
- debug: "XYZ",
- reserved: []
+ mangle = {
+ properties: {
+ debug: "XYZ",
+ keep_quoted: true,
+ reserved: [],
+ },
}
beautify = {
beautify: false,
@@ -774,3 +786,21 @@ issue_2208_5: {
}
expect_stdout: "42"
}
+
+issue_2256: {
+ options = {
+ side_effects: true,
+ }
+ mangle = {
+ properties: {
+ keep_quoted: true,
+ },
+ }
+ input: {
+ ({ "keep": 1 });
+ g.keep = g.change;
+ }
+ expect: {
+ g.keep = g.g;
+ }
+}