diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-04-03 12:31:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-03 12:31:05 +0800 |
commit | 59a4e56bc81ce96b3ee81ad4f068cfc7d89a4790 (patch) | |
tree | c92eb1c04b50b052d61c9f5f9431e4157535317c /test/compress/issue-1770.js | |
parent | 1f1fccc45df9fdc8a77d2ee3f1ae36f029b31ee9 (diff) | |
download | tracifyjs-59a4e56bc81ce96b3ee81ad4f068cfc7d89a4790.tar.gz tracifyjs-59a4e56bc81ce96b3ee81ad4f068cfc7d89a4790.zip |
fix mangleProperties of `undefined` & `Infinity` (#1772)
`NaN` already works by the happy accident of `Number.NaN`
fixes #1770
Diffstat (limited to 'test/compress/issue-1770.js')
-rw-r--r-- | test/compress/issue-1770.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/compress/issue-1770.js b/test/compress/issue-1770.js new file mode 100644 index 00000000..69df8960 --- /dev/null +++ b/test/compress/issue-1770.js @@ -0,0 +1,48 @@ +mangle_props: { + mangle_props = {} + input: { + var obj = { + undefined: 1, + NaN: 2, + Infinity: 3, + "-Infinity": 4, + }; + console.log( + obj[void 0], + obj[undefined], + obj["undefined"], + obj[0/0], + obj[NaN], + obj["NaN"], + obj[1/0], + obj[Infinity], + obj["Infinity"], + obj[-1/0], + obj[-Infinity], + obj["-Infinity"] + ); + } + expect: { + var obj = { + undefined: 1, + NaN: 2, + Infinity: 3, + "-Infinity": 4, + }; + console.log( + obj[void 0], + obj[void 0], + obj["undefined"], + obj[0/0], + obj[NaN], + obj["NaN"], + obj[1/0], + obj[1/0], + obj["Infinity"], + obj[-1/0], + obj[-1/0], + obj["-Infinity"] + ); + } + expect_stdout: true +} |