fix handling of shebang and preamble (#1545)

fixes #1332
This commit is contained in:
Alex Lam S.L
2017-03-05 12:16:02 +08:00
committed by GitHub
parent 78d1bb92d4
commit eb98a7f2f3
3 changed files with 29 additions and 29 deletions

View File

@@ -72,4 +72,12 @@ describe("comment filters", function() {
assert.strictEqual(UglifyJS.parse("/* ok */ function a(){}").print_to_string(options), "/* ok */function a(){}");
assert.strictEqual(UglifyJS.parse("/* ok */ function a(){}").print_to_string(options), "/* ok */function a(){}");
});
it("Should handle shebang and preamble correctly", function() {
var code = UglifyJS.minify("#!/usr/bin/node\nvar x = 10;", {
fromString: true,
output: { preamble: "/* Build */" }
}).code;
assert.strictEqual(code, "#!/usr/bin/node\n/* Build */\nvar x=10;");
})
});