aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-02-11 19:26:12 +0000
committerGitHub <noreply@github.com>2021-02-12 03:26:12 +0800
commit83197ffdb3c9055b5699674e111d2dee390d5560 (patch)
tree76fb066c8c4d4510a5399560285a31b618eb054e /test
parent952765be66e45a10f59ef900a1bd4d90e38e9cf5 (diff)
downloadtracifyjs-83197ffdb3c9055b5699674e111d2dee390d5560.tar.gz
tracifyjs-83197ffdb3c9055b5699674e111d2dee390d5560.zip
fix corner case in `evaluate` (#4645)
fixes #4644
Diffstat (limited to 'test')
-rw-r--r--test/compress/rests.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/compress/rests.js b/test/compress/rests.js
index 21adf204..59e29457 100644
--- a/test/compress/rests.js
+++ b/test/compress/rests.js
@@ -714,3 +714,52 @@ issue_4621: {
expect_stdout: "PASS"
node_version: ">=6"
}
+
+issue_4644_1: {
+ options = {
+ evaluate: true,
+ }
+ input: {
+ var a = "FAIL";
+ (function f(b, ...{
+ [a = "PASS"]: c,
+ }) {
+ return b;
+ })();
+ console.log(a);
+ }
+ expect: {
+ var a = "FAIL";
+ (function f(b, ...{
+ [a = "PASS"]: c,
+ }) {
+ return b;
+ })();
+ console.log(a);
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}
+
+issue_4644_2: {
+ options = {
+ evaluate: true,
+ unsafe: true,
+ }
+ input: {
+ console.log(function(...a) {
+ return a[1];
+ }("FAIL", "PASS"), function(...b) {
+ return b.length;
+ }(), function(c, ...d) {
+ return d[0];
+ }("FAIL"));
+ }
+ expect: {
+ console.log("PASS", 0, function(c, ...d) {
+ return d[0];
+ }("FAIL"));
+ }
+ expect_stdout: "PASS 0 undefined"
+ node_version: ">=6"
+}