aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-03-15 09:51:32 +0000
committerGitHub <noreply@github.com>2021-03-15 17:51:32 +0800
commit149d75c09273ec1cb7e2d04d46d2b9be26ae91bf (patch)
tree930ad470a642129f4f523c982b1b45e0efbc69a0 /test
parent2619bff3cf71bbb4be9b0178272af72b42878496 (diff)
downloadtracifyjs-149d75c09273ec1cb7e2d04d46d2b9be26ae91bf.tar.gz
tracifyjs-149d75c09273ec1cb7e2d04d46d2b9be26ae91bf.zip
fix corner case in `unsafe` (#4779)
Diffstat (limited to 'test')
-rw-r--r--test/compress/spreads.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/compress/spreads.js b/test/compress/spreads.js
index ba10167a..f8c0d592 100644
--- a/test/compress/spreads.js
+++ b/test/compress/spreads.js
@@ -689,6 +689,57 @@ unused_var_side_effects: {
node_version: ">=8"
}
+unsafe_join_1: {
+ options = {
+ unsafe: true,
+ }
+ input: {
+ console.log([ ..."foo" ].join());
+ }
+ expect: {
+ console.log([ ..."foo" ].join());
+ }
+ expect_stdout: "f,o,o"
+ node_version: ">=6"
+}
+
+unsafe_join_2: {
+ options = {
+ evaluate: true,
+ unsafe: true,
+ }
+ input: {
+ console.log([ "foo", ..."bar" ].join(""));
+ }
+ expect: {
+ console.log([ "foo", ..."bar" ].join(""));
+ }
+ expect_stdout: "foobar"
+ node_version: ">=6"
+}
+
+unsafe_join_3: {
+ options = {
+ unsafe: true,
+ }
+ input: {
+ try {
+ [].join(...console);
+ } catch (e) {
+ console.log("PASS");
+ }
+ }
+ expect: {
+ try {
+ [].join(...console);
+ } catch (e) {
+ console.log("PASS");
+ }
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}
+
issue_4329: {
options = {
objects: true,