aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-12-07 22:51:20 +0000
committerGitHub <noreply@github.com>2020-12-08 06:51:20 +0800
commitc587d7917d445e97ed8580251547870256237b63 (patch)
tree689b1c396045071e8e94e1ef3b68a798b7437551 /test/compress
parent336336f53f7f1ba161abc7834da190504afeb27b (diff)
downloadtracifyjs-c587d7917d445e97ed8580251547870256237b63.tar.gz
tracifyjs-c587d7917d445e97ed8580251547870256237b63.zip
introduce `spread` (#4346)
fixes #4345
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/objects.js10
-rw-r--r--test/compress/spread.js44
2 files changed, 43 insertions, 11 deletions
diff --git a/test/compress/objects.js b/test/compress/objects.js
index 51b7bcc4..5d3653d0 100644
--- a/test/compress/objects.js
+++ b/test/compress/objects.js
@@ -45,8 +45,8 @@ duplicate_key_strict: {
"use strict";
var o = {
a: 1,
- b: 2,
a: 3,
+ b: 2,
};
for (var k in o)
console.log(k, o[k]);
@@ -323,8 +323,8 @@ issue_4269_3: {
}
expect: {
console.log({
- ["foo"]: "bar",
- get 42() {
+ foo: "bar",
+ get [42]() {
return "FAIL";
},
42: "PASS",
@@ -353,8 +353,8 @@ issue_4269_4: {
get 42() {
return "FAIL";
},
- ["foo"]: "bar",
- 42: "PASS",
+ foo: "bar",
+ [42]: "PASS",
}[42]);
}
expect_stdout: "PASS"
diff --git a/test/compress/spread.js b/test/compress/spread.js
index 6763d4f7..aaa8a7f7 100644
--- a/test/compress/spread.js
+++ b/test/compress/spread.js
@@ -105,8 +105,8 @@ dont_inline: {
do_inline: {
options = {
- properties: true,
inline: true,
+ spread: true,
}
input: {
console.log(function(a) {
@@ -144,8 +144,8 @@ drop_empty_call_1: {
drop_empty_call_2: {
options = {
- properties: true,
side_effects: true,
+ spread: true,
}
input: {
(function() {})(...[ console.log("PASS") ]);
@@ -159,7 +159,7 @@ drop_empty_call_2: {
convert_hole: {
options = {
- properties: true,
+ spread: true,
}
input: {
console.log(...[ "PASS", , 42 ]);
@@ -295,7 +295,8 @@ keep_getter: {
keep_accessor: {
options = {
- properties: true,
+ objects: true,
+ spread: true,
}
input: {
var o = {
@@ -372,7 +373,8 @@ unused_var_side_effects: {
issue_4329: {
options = {
- properties: true,
+ objects: true,
+ spread: true,
}
input: {
console.log({
@@ -423,7 +425,7 @@ issue_4331: {
console.log(b);
}
expect_stdout: "PASS"
- node_version: ">=8"
+ node_version: ">=6"
}
issue_4342: {
@@ -447,3 +449,33 @@ issue_4342: {
expect_stdout: "PASS"
node_version: ">=6"
}
+
+issue_4345: {
+ options = {
+ objects: true,
+ spread: true,
+ }
+ input: {
+ console.log({
+ ...{
+ get 42() {
+ return "FAIL";
+ },
+ ...{},
+ 42: "PASS",
+ },
+ }[42]);
+ }
+ expect: {
+ console.log({
+ ...{
+ get 42() {
+ return "FAIL";
+ },
+ [42]: "PASS",
+ },
+ }[42]);
+ }
+ expect_stdout: "PASS"
+ node_version: ">=8"
+}