aboutsummaryrefslogtreecommitdiff
path: root/test/mocha
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-12-20 12:48:51 +0000
committerGitHub <noreply@github.com>2020-12-20 20:48:51 +0800
commit7aefe97083c63660cf0708e549aebce66248796b (patch)
treeb7bde3b849be0303ab6ca7118677a95767b3af68 /test/mocha
parent89198e0ad4e302546e0ec8b6653ee1b92ce09b1a (diff)
downloadtracifyjs-7aefe97083c63660cf0708e549aebce66248796b.tar.gz
tracifyjs-7aefe97083c63660cf0708e549aebce66248796b.zip
parse destructuring under strict mode correctly (#4429)
Diffstat (limited to 'test/mocha')
-rw-r--r--test/mocha/cli.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/mocha/cli.js b/test/mocha/cli.js
index 034c8440..c050b717 100644
--- a/test/mocha/cli.js
+++ b/test/mocha/cli.js
@@ -573,6 +573,20 @@ describe("bin/uglifyjs", function() {
done();
});
});
+ it("Should throw syntax error (var { eval })", function(done) {
+ var command = uglifyjscmd + " test/input/invalid/destructured_var.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/destructured_var.js:7,10",
+ " var { eval } = 42;",
+ " ^",
+ "ERROR: Unexpected eval in strict mode"
+ ].join("\n"));
+ done();
+ });
+ });
it("Should throw syntax error (else)", function(done) {
var command = uglifyjscmd + " test/input/invalid/else.js";
exec(command, function(err, stdout, stderr) {