handle trailing line comments correctly (#2736)

fixes #2734
This commit is contained in:
Alex Lam S.L
2018-01-06 21:05:21 +08:00
committed by GitHub
parent 3564b4f20d
commit 659c8a7632
2 changed files with 26 additions and 2 deletions

View File

@@ -219,4 +219,24 @@ describe("Comment", function() {
if (result.error) throw result.error;
assert.strictEqual(result.code, "/*a*/ /*b*/(function(){/*c*/}/*d*/ /*e*/)();");
});
it("Should output line comments after statements", function() {
var result = uglify.minify([
"x()//foo",
"{y()//bar",
"}",
].join("\n"), {
compress: false,
mangle: false,
output: {
comments: "all",
},
});
if (result.error) throw result.error;
assert.strictEqual(result.code, [
"x();//foo",
"{y();//bar",
"}",
].join("\n"));
});
});