diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-03-15 09:51:32 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-15 17:51:32 +0800 |
commit | 149d75c09273ec1cb7e2d04d46d2b9be26ae91bf (patch) | |
tree | 930ad470a642129f4f523c982b1b45e0efbc69a0 /test | |
parent | 2619bff3cf71bbb4be9b0178272af72b42878496 (diff) | |
download | tracifyjs-149d75c09273ec1cb7e2d04d46d2b9be26ae91bf.tar.gz tracifyjs-149d75c09273ec1cb7e2d04d46d2b9be26ae91bf.zip |
fix corner case in `unsafe` (#4779)
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/spreads.js | 51 |
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, |