diff options
author | Mihai Bazon <mihai.bazon@gmail.com> | 2013-09-19 18:20:45 +0300 |
---|---|---|
committer | Mihai Bazon <mihai.bazon@gmail.com> | 2013-09-19 18:20:45 +0300 |
commit | 78e98d2611f5698797785adbd12faf2ba46ec783 (patch) | |
tree | 6bace696ebb22da18ef3fb06289ffee963ffb9dc /test | |
parent | 8d14efe818d9a33821a6acc26b612aaf1fd6e967 (diff) | |
download | tracifyjs-78e98d2611f5698797785adbd12faf2ba46ec783.tar.gz tracifyjs-78e98d2611f5698797785adbd12faf2ba46ec783.zip |
When `unsafe` is set, evaluate [...].join() if possible
Close #298
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/arrays.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/compress/arrays.js b/test/compress/arrays.js index 0c3d8ba2..214928dd 100644 --- a/test/compress/arrays.js +++ b/test/compress/arrays.js @@ -12,3 +12,22 @@ holes_and_undefined: { z=[1,void 0,3]; } } + +constant_join: { + options = { + unsafe : true, + evaluate : true + }; + input: { + var a = [ "foo", "bar", "baz" ].join(""); + var b = [ "foo", 1, 2, 3, "bar" ].join(""); + var c = [ boo(), "foo", 1, 2, 3, "bar", bar() ].join(""); + var d = [ "foo", 1 + 2 + "bar", "baz" ].join("-"); + } + expect: { + var a = "foobarbaz"; + var b = "foo123bar"; + var c = [ boo(), "foo", 1, 2, 3, "bar", bar() ].join(""); // we could still shorten this one, but oh well. + var d = "foo-3bar-baz"; + } +} |