From fc3010bec5b8d5617dc52494751ded6969a9952e Mon Sep 17 00:00:00 2001 From: alexlamsl Date: Sun, 24 Dec 2017 20:42:01 +0800 Subject: [PATCH] add tests for #2613 --- test/compress/functions.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/compress/functions.js b/test/compress/functions.js index 478ee561..381b53a8 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -990,6 +990,20 @@ unsafe_apply_2: { expect_stdout: true } +unsafe_apply_expansion: { + options = { + unsafe: true, + } + input: { + console.log.apply(console, [1, ...[2, 3], 4]); + } + expect: { + console.log.call(console, 1, ...[2, 3], 4); + } + expect_stdout: "1 2 3 4" + node_version: ">=6" +} + unsafe_call_1: { options = { inline: true, @@ -1068,6 +1082,25 @@ unsafe_call_3: { expect_stdout: "3" } +unsafe_call_expansion: { + options = { + unsafe: true, + } + input: { + (function(...a) { + console.log(...a); + }).call(console, 1, ...[2, 3], 4); + } + expect: { + console, + (function(...a) { + console.log(...a); + })(1, ...[2, 3], 4); + } + expect_stdout: "1 2 3 4" + node_version: ">=6" +} + issue_2616: { options = { evaluate: true,