diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-04-02 16:14:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-02 16:14:09 +0800 |
commit | d57527697fba37bfad50ca0283326a458cdea031 (patch) | |
tree | 37dfea84a5647a446265b524ec4f498341d043df /test/compress | |
parent | f7ca4f229795f87674d32e2df3de3cf1f8367a39 (diff) | |
download | tracifyjs-d57527697fba37bfad50ca0283326a458cdea031.tar.gz tracifyjs-d57527697fba37bfad50ca0283326a458cdea031.zip |
avoid confusion of `NaN` & `Infinity` with `catch` symbol of the same name (#1763)
fixes #1760
fixes #1761
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/evaluate.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js index 0d26e749..fa432c46 100644 --- a/test/compress/evaluate.js +++ b/test/compress/evaluate.js @@ -802,3 +802,58 @@ issue_1649: { } expect_stdout: "-2"; } + +issue_1760_1: { + options = { + evaluate: true, + } + input: { + !function(a) { + try { + throw 0; + } catch (NaN) { + a = +"foo"; + } + console.log(a); + }(); + } + expect: { + !function(a) { + try { + throw 0; + } catch (NaN) { + a = 0 / 0; + } + console.log(a); + }(); + } + expect_stdout: "NaN" +} + +issue_1760_2: { + options = { + evaluate: true, + keep_infinity: true, + } + input: { + !function(a) { + try { + throw 0; + } catch (Infinity) { + a = 123456789 / 0; + } + console.log(a); + }(); + } + expect: { + !function(a) { + try { + throw 0; + } catch (Infinity) { + a = 1 / 0; + } + console.log(a); + }(); + } + expect_stdout: "Infinity" +} |