aboutsummaryrefslogtreecommitdiff
path: root/test/mocha
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-02-28 02:25:44 +0800
committerGitHub <noreply@github.com>2017-02-28 02:25:44 +0800
commit858e6c78a44f236e6e4d460a2ac187eef59823c8 (patch)
treea8e8ade5e968ae8a7791de37409ef8c001d7b41f /test/mocha
parent0b0296eb2aebbb6f3df72d4e4ef22d447fe396ec (diff)
downloadtracifyjs-858e6c78a44f236e6e4d460a2ac187eef59823c8.tar.gz
tracifyjs-858e6c78a44f236e6e4d460a2ac187eef59823c8.zip
warn & drop `#__PURE__` iff IIFE is dropped (#1511)
- consolidate `side-effects` optimisations - improve string `+` optimisation - enhance literal & `conditionals` optimisations
Diffstat (limited to 'test/mocha')
-rw-r--r--test/mocha/minify.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/mocha/minify.js b/test/mocha/minify.js
index 0cf8c5c1..baac2a41 100644
--- a/test/mocha/minify.js
+++ b/test/mocha/minify.js
@@ -154,6 +154,17 @@ describe("minify", function() {
var code = result.code;
assert.strictEqual(code, "// comment1 comment2\nbar();");
});
+ it("should not drop #__PURE__ hint if function is retained", function() {
+ var result = Uglify.minify("var a = /*#__PURE__*/(function(){return 1})();", {
+ fromString: true,
+ output: {
+ comments: "all",
+ beautify: false,
+ }
+ });
+ var code = result.code;
+ assert.strictEqual(code, "var a=/*#__PURE__*/function(){return 1}();");
+ })
});
describe("JS_Parse_Error", function() {