support trailing commas in function parameter lists and calls (#2156)

fixes #2155
This commit is contained in:
Alex Lam S.L
2017-06-24 17:34:14 +08:00
committed by GitHub
parent d1f085bce7
commit 94f93ad82d
4 changed files with 91 additions and 25 deletions

View File

@@ -596,6 +596,21 @@ describe("bin/uglifyjs", function () {
done();
});
});
it("Should throw syntax error (spread in sequence)", function(done) {
var command = uglifyjscmd + ' test/input/invalid/sequence.js';
exec(command, function (err, stdout, stderr) {
assert.ok(err);
assert.strictEqual(stdout, "");
assert.strictEqual(stderr.split(/\n/).slice(0, 4).join("\n"), [
"Parse error at test/input/invalid/sequence.js:1,4",
"(a, ...b);",
" ^",
"ERROR: Unexpected token: expand (...)"
].join("\n"));
done();
});
});
it("Should handle literal string as source map input", function(done) {
var command = [
uglifyjscmd,