aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-04-02 16:14:09 +0800
committerGitHub <noreply@github.com>2017-04-02 16:14:09 +0800
commitd57527697fba37bfad50ca0283326a458cdea031 (patch)
tree37dfea84a5647a446265b524ec4f498341d043df /test/compress
parentf7ca4f229795f87674d32e2df3de3cf1f8367a39 (diff)
downloadtracifyjs-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.js55
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"
+}