aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-02-26 00:40:33 +0800
committerGitHub <noreply@github.com>2017-02-26 00:40:33 +0800
commit16cd5d57a5cf7f5750104df0e5af246708fd493f (patch)
treee9ea6b8432ce0bddeeeef317f96765de1467ceeb /test
parent834f9f39245f1ddf5a29c579afd7ebcdb0afe585 (diff)
downloadtracifyjs-16cd5d57a5cf7f5750104df0e5af246708fd493f.tar.gz
tracifyjs-16cd5d57a5cf7f5750104df0e5af246708fd493f.zip
consolidate `evaluate` & `reduce_vars` (#1505)
- improve marking efficiency - apply smarter `const` replacement to `var` fixes #1501
Diffstat (limited to 'test')
-rw-r--r--test/compress/evaluate.js2
-rw-r--r--test/compress/reduce_vars.js16
-rw-r--r--test/mocha/comment_before_constant.js6
3 files changed, 12 insertions, 12 deletions
diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js
index ae5e58d6..5cefadc8 100644
--- a/test/compress/evaluate.js
+++ b/test/compress/evaluate.js
@@ -615,7 +615,7 @@ call_args: {
const a = 1;
console.log(1);
+function(a) {
- return a;
+ return 1;
}(1);
}
}
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index d9d02efa..0ee201c0 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -134,8 +134,8 @@ modified: {
}
function f2() {
- var b = 2, c = 3;
- b = c;
+ var b = 2;
+ b = 3;
console.log(1 + b);
console.log(b + 3);
console.log(4);
@@ -143,8 +143,8 @@ modified: {
}
function f3() {
- var b = 2, c = 3;
- b *= c;
+ var b = 2;
+ b *= 3;
console.log(1 + b);
console.log(b + 3);
console.log(4);
@@ -236,7 +236,7 @@ unsafe_evaluate_object: {
function f0(){
var a = 1;
var b = {};
- b[a] = 2;
+ b[1] = 2;
console.log(4);
}
@@ -280,7 +280,7 @@ unsafe_evaluate_array: {
function f0(){
var a = 1;
var b = [];
- b[a] = 2;
+ b[1] = 2;
console.log(4);
}
@@ -373,8 +373,8 @@ passes: {
}
expect: {
function f() {
- var b = 2, c = 3;
- b = c;
+ var b = 2;
+ b = 3;
console.log(1 + b);
console.log(b + 3);
console.log(4);
diff --git a/test/mocha/comment_before_constant.js b/test/mocha/comment_before_constant.js
index cfdb6da1..eaa8691c 100644
--- a/test/mocha/comment_before_constant.js
+++ b/test/mocha/comment_before_constant.js
@@ -7,7 +7,7 @@ describe("comment before constant", function() {
it("Should test comment before constant is retained and output after mangle.", function() {
var result = Uglify.minify(js, {
fromString: true,
- compress: { collapse_vars: false },
+ compress: { collapse_vars: false, reduce_vars: false },
mangle: {},
output: { comments: true },
});
@@ -17,9 +17,9 @@ describe("comment before constant", function() {
it("Should test code works when comments disabled.", function() {
var result = Uglify.minify(js, {
fromString: true,
- compress: { collapse_vars: false },
+ compress: { collapse_vars: false, reduce_vars: false },
mangle: {},
- output: {},
+ output: { comments: false },
});
assert.strictEqual(result.code, 'function f(){var n=!1;return n}');
});