diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2019-10-30 03:49:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-30 03:49:39 +0800 |
commit | 0f4cfa877a9f14a75b219c04947ce5984772d8ba (patch) | |
tree | f06c7ea1744fff0afd911816806da82951c9ca57 /test/mocha/comments.js | |
parent | 1d5c2becbd4e0266a702db93649dbe025056b885 (diff) | |
download | tracifyjs-0f4cfa877a9f14a75b219c04947ce5984772d8ba.tar.gz tracifyjs-0f4cfa877a9f14a75b219c04947ce5984772d8ba.zip |
fix corner case in `comments` (#3550)
Diffstat (limited to 'test/mocha/comments.js')
-rw-r--r-- | test/mocha/comments.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/mocha/comments.js b/test/mocha/comments.js index 764f6db8..9a4b3be6 100644 --- a/test/mocha/comments.js +++ b/test/mocha/comments.js @@ -259,6 +259,30 @@ describe("comments", function() { assert.strictEqual(result.code, code); }); + it("Should handle comments around parenthesis correctly", function() { + var code = [ + "a();", + "/* foo */", + "(b())", + "/* bar */", + "c();", + ].join("\n"); + var result = UglifyJS.minify(code, { + compress: false, + mangle: false, + output: { + comments: "all", + }, + }); + if (result.error) throw result.error; + assert.strictEqual(result.code, [ + "a();", + "/* foo */", + "b()", + "/* bar */;c();", + ].join("\n")); + }); + it("Should preserve comments around IIFE", function() { var result = UglifyJS.minify("/*a*/(/*b*/function(){/*c*/}/*d*/)/*e*/();", { compress: false, |