aboutsummaryrefslogtreecommitdiff
path: root/test/mocha/comment.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-03-13 18:44:21 +0800
committerGitHub <noreply@github.com>2018-03-13 18:44:21 +0800
commit188c39e8d5b3fba5a7cb92fbf5867c9f3e897c46 (patch)
tree8123e3a00c93b23448135293ed3c500ddd8b9b3f /test/mocha/comment.js
parent5429234138b1645d0c06de48c60e3c5469a81daf (diff)
downloadtracifyjs-188c39e8d5b3fba5a7cb92fbf5867c9f3e897c46.tar.gz
tracifyjs-188c39e8d5b3fba5a7cb92fbf5867c9f3e897c46.zip
retain comments within brackets (#2999)
fixes #2998
Diffstat (limited to 'test/mocha/comment.js')
-rw-r--r--test/mocha/comment.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/mocha/comment.js b/test/mocha/comment.js
index 4db46b52..74ae962c 100644
--- a/test/mocha/comment.js
+++ b/test/mocha/comment.js
@@ -139,6 +139,26 @@ describe("Comment", function() {
assert.strictEqual(result.code, code);
});
+ it("Should retain comments within brackets", function() {
+ var code = [
+ "{/* foo */}",
+ "a({/* foo */});",
+ "while (a) {/* foo */}",
+ "switch (a) {/* foo */}",
+ "if (a) {/* foo */} else {/* bar */}",
+ ].join("\n\n");
+ var result = uglify.minify(code, {
+ compress: false,
+ mangle: false,
+ output: {
+ beautify: true,
+ comments: "all",
+ },
+ });
+ if (result.error) throw result.error;
+ assert.strictEqual(result.code, code);
+ });
+
it("Should correctly preserve new lines around comments", function() {
var tests = [
[