2012-08-22 12:21:58 +00:00
|
|
|
keep_properties: {
|
|
|
|
|
options = {
|
|
|
|
|
properties: false
|
|
|
|
|
};
|
|
|
|
|
input: {
|
|
|
|
|
a["foo"] = "bar";
|
|
|
|
|
}
|
|
|
|
|
expect: {
|
|
|
|
|
a["foo"] = "bar";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dot_properties: {
|
|
|
|
|
options = {
|
|
|
|
|
properties: true
|
|
|
|
|
};
|
|
|
|
|
input: {
|
|
|
|
|
a["foo"] = "bar";
|
|
|
|
|
a["if"] = "if";
|
2013-05-05 14:08:13 +00:00
|
|
|
a["*"] = "asterisk";
|
2013-05-05 17:26:33 +00:00
|
|
|
a["\u0EB3"] = "unicode";
|
2013-05-08 19:29:46 +00:00
|
|
|
a[""] = "whitespace";
|
2013-05-14 07:41:28 +00:00
|
|
|
a["1_1"] = "foo";
|
2012-08-22 12:21:58 +00:00
|
|
|
}
|
|
|
|
|
expect: {
|
|
|
|
|
a.foo = "bar";
|
|
|
|
|
a["if"] = "if";
|
2013-05-05 14:08:13 +00:00
|
|
|
a["*"] = "asterisk";
|
2014-04-18 08:19:52 +00:00
|
|
|
a["\u0EB3"] = "unicode";
|
2013-05-08 19:29:46 +00:00
|
|
|
a[""] = "whitespace";
|
2013-05-14 07:41:28 +00:00
|
|
|
a["1_1"] = "foo";
|
2012-08-22 12:21:58 +00:00
|
|
|
}
|
|
|
|
|
}
|
2013-04-20 20:11:05 +00:00
|
|
|
|
|
|
|
|
dot_properties_es5: {
|
|
|
|
|
options = {
|
|
|
|
|
properties: true,
|
|
|
|
|
screw_ie8: true
|
|
|
|
|
};
|
|
|
|
|
input: {
|
|
|
|
|
a["foo"] = "bar";
|
|
|
|
|
a["if"] = "if";
|
2013-05-05 14:08:13 +00:00
|
|
|
a["*"] = "asterisk";
|
2013-05-05 17:26:33 +00:00
|
|
|
a["\u0EB3"] = "unicode";
|
2013-05-08 19:29:46 +00:00
|
|
|
a[""] = "whitespace";
|
2013-04-20 20:11:05 +00:00
|
|
|
}
|
|
|
|
|
expect: {
|
|
|
|
|
a.foo = "bar";
|
|
|
|
|
a.if = "if";
|
2013-05-05 14:08:13 +00:00
|
|
|
a["*"] = "asterisk";
|
2014-04-18 08:19:52 +00:00
|
|
|
a["\u0EB3"] = "unicode";
|
2013-05-08 19:29:46 +00:00
|
|
|
a[""] = "whitespace";
|
2013-04-20 20:11:05 +00:00
|
|
|
}
|
|
|
|
|
}
|
2014-06-30 22:51:42 +00:00
|
|
|
|
|
|
|
|
evaluate_length: {
|
|
|
|
|
options = {
|
|
|
|
|
properties: true,
|
|
|
|
|
unsafe: true,
|
|
|
|
|
evaluate: true
|
|
|
|
|
};
|
|
|
|
|
input: {
|
|
|
|
|
a = "foo".length;
|
|
|
|
|
a = ("foo" + "bar")["len" + "gth"];
|
|
|
|
|
a = b.length;
|
|
|
|
|
a = ("foo" + b).length;
|
|
|
|
|
}
|
|
|
|
|
expect: {
|
|
|
|
|
a = 3;
|
|
|
|
|
a = 6;
|
|
|
|
|
a = b.length;
|
|
|
|
|
a = ("foo" + b).length;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-05-05 20:44:59 +00:00
|
|
|
|
|
|
|
|
mangle_properties: {
|
|
|
|
|
mangle_props = {
|
|
|
|
|
ignore_quoted: false
|
|
|
|
|
};
|
|
|
|
|
input: {
|
|
|
|
|
a["foo"] = "bar";
|
|
|
|
|
a.color = "red";
|
|
|
|
|
x = {"bar": 10};
|
|
|
|
|
}
|
|
|
|
|
expect: {
|
|
|
|
|
a["a"] = "bar";
|
|
|
|
|
a.b = "red";
|
|
|
|
|
x = {c: 10};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mangle_unquoted_properties: {
|
|
|
|
|
mangle_props = {
|
|
|
|
|
ignore_quoted: true
|
|
|
|
|
}
|
|
|
|
|
beautify = {
|
|
|
|
|
beautify: false,
|
|
|
|
|
quote_style: 3,
|
|
|
|
|
keep_quoted_props: true,
|
|
|
|
|
}
|
|
|
|
|
input: {
|
|
|
|
|
function f1() {
|
|
|
|
|
a["foo"] = "bar";
|
|
|
|
|
a.color = "red";
|
|
|
|
|
x = {"bar": 10};
|
|
|
|
|
}
|
|
|
|
|
function f2() {
|
|
|
|
|
a.foo = "bar";
|
|
|
|
|
a['color'] = "red";
|
|
|
|
|
x = {bar: 10};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
expect: {
|
|
|
|
|
function f1() {
|
|
|
|
|
a["foo"] = "bar";
|
|
|
|
|
a.a = "red";
|
|
|
|
|
x = {"bar": 10};
|
|
|
|
|
}
|
|
|
|
|
function f2() {
|
|
|
|
|
a.b = "bar";
|
|
|
|
|
a['color'] = "red";
|
|
|
|
|
x = {c: 10};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|