diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index 19099424..994c0aee 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -2605,6 +2605,62 @@ accessor_2: { expect_stdout: "1" } +method_1: { + options = { + evaluate: true, + reduce_vars: true, + toplevel: true, + } + input: { + var a = 1; + console.log(new class { + a() { + a = 2; + return a; + } + }().a(), a); + } + expect: { + var a = 1; + console.log(new class { + a() { + a = 2; + return a; + } + }().a(), a); + } + expect_stdout: "2 2" + node_version: ">=6" +} + +method_2: { + options = { + collapse_vars: true, + evaluate: true, + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + var A = 1; + var B = class { + c() { + console.log(A); + } + }; + new B().c(); + } + expect: { + new class { + c() { + console.log(1); + } + }().c(); + } + expect_stdout: "1" + node_version: ">=6" +} + issue_2090_1: { options = { evaluate: true, diff --git a/test/mocha/minify.js b/test/mocha/minify.js index 45f918a5..db32739b 100644 --- a/test/mocha/minify.js +++ b/test/mocha/minify.js @@ -76,6 +76,7 @@ describe("minify", function() { it("should not parse invalid use of reserved words", function() { assert.strictEqual(Uglify.minify("function enum(){}").error, undefined); assert.strictEqual(Uglify.minify("function static(){}").error, undefined); + assert.strictEqual(Uglify.minify("function super(){}").error.message, "Unexpected token: name (super)"); assert.strictEqual(Uglify.minify("function this(){}").error.message, "Unexpected token: name (this)"); });