diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/functions.js | 22 | ||||
-rw-r--r-- | test/compress/issue-1787.js | 6 | ||||
-rw-r--r-- | test/compress/negate-iife.js | 8 |
3 files changed, 25 insertions, 11 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js index 2a2d0965..3a560f00 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -145,3 +145,25 @@ issue_1841_2: { } expect_exact: "42" } + +function_returning_constant_literal: { + options = { + reduce_vars: true, + unsafe: true, + toplevel: true, + evaluate: true, + cascade: true, + unused: true, + } + input: { + function greeter() { + return { message: 'Hello there' }; + } + var greeting = greeter(); + console.log(greeting.message); + } + expect: { + console.log("Hello there"); + } + expect_stdout: "Hello there" +} diff --git a/test/compress/issue-1787.js b/test/compress/issue-1787.js index 43d1f1be..02fa0f91 100644 --- a/test/compress/issue-1787.js +++ b/test/compress/issue-1787.js @@ -10,10 +10,6 @@ unary_prefix: { return x; }()); } - expect: { - console.log(function() { - return -2 / 3; - }()); - } + expect_exact: "console.log(-2/3);" expect_stdout: true } diff --git a/test/compress/negate-iife.js b/test/compress/negate-iife.js index 343e8e16..514a15c7 100644 --- a/test/compress/negate-iife.js +++ b/test/compress/negate-iife.js @@ -25,11 +25,9 @@ negate_iife_2: { negate_iife: true }; input: { - (function(){ return {} })().x = 10; // should not transform this one - } - expect: { (function(){ return {} })().x = 10; } + expect_exact: "({}).x=10;" } negate_iife_2_side_effects: { @@ -38,11 +36,9 @@ negate_iife_2_side_effects: { side_effects: true, } input: { - (function(){ return {} })().x = 10; // should not transform this one - } - expect: { (function(){ return {} })().x = 10; } + expect_exact: "({}).x=10;" } negate_iife_3: { |