aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-06-23 15:53:13 +0800
committerGitHub <noreply@github.com>2017-06-23 15:53:13 +0800
commitdc6bcaa18eda80f31674a1f8167d7fbe997f743b (patch)
tree3124db40e4b400402c6b937963830c0d9c436e87 /test/compress
parentd58b184835d9c2316bfb4411d0907ebb4446aaf0 (diff)
downloadtracifyjs-dc6bcaa18eda80f31674a1f8167d7fbe997f743b.tar.gz
tracifyjs-dc6bcaa18eda80f31674a1f8167d7fbe997f743b.zip
synchronise `mangle.properties` for `minify()` & `test/compress` (#2151)
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/functions.js2
-rw-r--r--test/compress/issue-1321.js18
-rw-r--r--test/compress/issue-1770.js66
-rw-r--r--test/compress/issue-747.js14
-rw-r--r--test/compress/properties.js22
5 files changed, 63 insertions, 59 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js
index d2640bb9..b5def8e1 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -265,7 +265,7 @@ issue_203: {
}
expect: {
var m = {};
- var fn = Function("a", "b", "b.exports=42");
+ var fn = Function("n", "o", "o.exports=42");
fn(null, m, m.exports);
console.log(m.exports);
}
diff --git a/test/compress/issue-1321.js b/test/compress/issue-1321.js
index dcbfde64..6b92291d 100644
--- a/test/compress/issue-1321.js
+++ b/test/compress/issue-1321.js
@@ -10,9 +10,9 @@ issue_1321_no_debug: {
}
expect: {
var x = {};
- x.b = 1;
- x["a"] = 2 * x.b;
- console.log(x.b, x["a"]);
+ x.o = 1;
+ x["a"] = 2 * x.o;
+ console.log(x.o, x["a"]);
}
expect_stdout: true
}
@@ -30,9 +30,9 @@ issue_1321_debug: {
}
expect: {
var x = {};
- x.a = 1;
- x["_$foo$_"] = 2 * x.a;
- console.log(x.a, x["_$foo$_"]);
+ x.o = 1;
+ x["_$foo$_"] = 2 * x.o;
+ console.log(x.o, x["_$foo$_"]);
}
expect_stdout: true
}
@@ -49,9 +49,9 @@ issue_1321_with_quoted: {
}
expect: {
var x = {};
- x.a = 1;
- x["b"] = 2 * x.a;
- console.log(x.a, x["b"]);
+ x.o = 1;
+ x["x"] = 2 * x.o;
+ console.log(x.o, x["x"]);
}
expect_stdout: true
}
diff --git a/test/compress/issue-1770.js b/test/compress/issue-1770.js
index 24134f81..f296a403 100644
--- a/test/compress/issue-1770.js
+++ b/test/compress/issue-1770.js
@@ -82,7 +82,7 @@ numeric_literal: {
' 42: 2,',
' "42": 3,',
' 37: 4,',
- ' a: 5,',
+ ' o: 5,',
' 1e42: 6,',
' b: 7,',
' "1e+42": 8',
@@ -92,7 +92,7 @@ numeric_literal: {
'',
'console.log(obj[42], obj["42"]);',
'',
- 'console.log(obj[37], obj["a"], obj[37], obj["37"]);',
+ 'console.log(obj[37], obj["o"], obj[37], obj["37"]);',
'',
'console.log(obj[1e42], obj["b"], obj["1e+42"]);',
]
@@ -173,32 +173,32 @@ identifier: {
}
expect: {
var obj = {
- a: 1,
- b: 2,
- c: 3,
- d: 4,
- e: 5,
- f: 6,
- g: 7,
- h: 8,
- i: 9,
- j: 10,
- k: 11,
- l: 12,
- m: 13,
- n: 14,
- o: 15,
- p: 16,
- q: 17,
- r: 18,
- s: 19,
- t: 20,
- u: 21,
- v: 22,
- w: 23,
- x: 24,
- y: 25,
- z: 26,
+ e: 1,
+ t: 2,
+ n: 3,
+ a: 4,
+ i: 5,
+ o: 6,
+ r: 7,
+ l: 8,
+ s: 9,
+ c: 10,
+ f: 11,
+ u: 12,
+ d: 13,
+ h: 14,
+ p: 15,
+ b: 16,
+ v: 17,
+ w: 18,
+ y: 19,
+ g: 20,
+ m: 21,
+ k: 22,
+ x: 23,
+ j: 24,
+ z: 25,
+ q: 26,
A: 27,
B: 28,
C: 29,
@@ -229,11 +229,11 @@ identifier: {
Z: 54,
$: 55,
_: 56,
- aa: 57,
- ba: 58,
- ca: 59,
- da: 60,
- ea: 61,
+ ee: 57,
+ te: 58,
+ ne: 59,
+ ae: 60,
+ ie: 61,
};
}
}
diff --git a/test/compress/issue-747.js b/test/compress/issue-747.js
index 0a4e4502..1f7079c2 100644
--- a/test/compress/issue-747.js
+++ b/test/compress/issue-747.js
@@ -1,37 +1,41 @@
dont_reuse_prop: {
mangle_props = {
regex: /asd/
- };
-
+ }
input: {
+ "aaaaaaaaaabbbbb";
var obj = {};
obj.a = 123;
obj.asd = 256;
console.log(obj.a);
}
expect: {
+ "aaaaaaaaaabbbbb";
var obj = {};
obj.a = 123;
obj.b = 256;
console.log(obj.a);
}
+ expect_stdout: "123"
}
unmangleable_props_should_always_be_reserved: {
mangle_props = {
regex: /asd/
- };
-
+ }
input: {
+ "aaaaaaaaaabbbbb";
var obj = {};
obj.asd = 256;
obj.a = 123;
console.log(obj.a);
}
expect: {
+ "aaaaaaaaaabbbbb";
var obj = {};
obj.b = 256;
obj.a = 123;
console.log(obj.a);
}
-} \ No newline at end of file
+ expect_stdout: "123"
+}
diff --git a/test/compress/properties.js b/test/compress/properties.js
index a83acc10..8126d6c6 100644
--- a/test/compress/properties.js
+++ b/test/compress/properties.js
@@ -135,11 +135,11 @@ mangle_properties: {
a['run']({color: "blue", foo: "baz"});
}
expect: {
- a["a"] = "bar";
- a.b = "red";
- x = {c: 10};
- a.d(x.c, a.a);
- a['d']({b: "blue", a: "baz"});
+ a["o"] = "bar";
+ a.a = "red";
+ x = {r: 10};
+ a.b(x.r, a.o);
+ a['b']({a: "blue", o: "baz"});
}
}
@@ -177,16 +177,16 @@ mangle_unquoted_properties: {
function f1() {
a["foo"] = "bar";
a.color = "red";
- a.b = 2;
- x = {"bar": 10, c: 7};
- a.c = 9;
+ a.o = 2;
+ x = {"bar": 10, f: 7};
+ a.f = 9;
}
function f2() {
a.foo = "bar";
a['color'] = "red";
- x = {bar: 10, c: 7};
- a.c = 9;
- a.b = 3;
+ x = {bar: 10, f: 7};
+ a.f = 9;
+ a.o = 3;
}
}
}