aboutsummaryrefslogtreecommitdiff
path: root/test/compress/properties.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-07-29 23:02:04 +0800
committerGitHub <noreply@github.com>2017-07-29 23:02:04 +0800
commita845897758aa2cbccf71f37643d31b08cdd22a0e (patch)
treea845d73050ec30bbc089252df13a2258053c5e65 /test/compress/properties.js
parent32ea2c5530079ddbbbc50b23b2adeff44ba7b5df (diff)
downloadtracifyjs-a845897758aa2cbccf71f37643d31b08cdd22a0e.tar.gz
tracifyjs-a845897758aa2cbccf71f37643d31b08cdd22a0e.zip
improve `mangle.properties` (#2261)
- include dead code when `keep_quoted` - unify `keep_quoted` & `reserved` - make `test/run-tests.js` consistent with `minify()` fixes #2256
Diffstat (limited to 'test/compress/properties.js')
-rw-r--r--test/compress/properties.js88
1 files changed, 59 insertions, 29 deletions
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;
+ }
+}