aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-01-08 10:28:10 +0800
committerGitHub <noreply@github.com>2020-01-08 10:28:10 +0800
commit14c35739ddb1c0b181d8c54566171f217014b563 (patch)
tree4c24265ebc3e76fb44c7611c5d1204e9d224ef35 /test/compress
parentf5ceff6e4b94a032078b0730f91662ee62758eb4 (diff)
downloadtracifyjs-14c35739ddb1c0b181d8c54566171f217014b563.tar.gz
tracifyjs-14c35739ddb1c0b181d8c54566171f217014b563.zip
fix corner case in `unsafe_math` (#3677)
fixes #3676
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/numbers.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/compress/numbers.js b/test/compress/numbers.js
index f49996a4..c40ca09d 100644
--- a/test/compress/numbers.js
+++ b/test/compress/numbers.js
@@ -1135,3 +1135,35 @@ issue_3655: {
"0",
]
}
+
+issue_3676_1: {
+ options = {
+ evaluate: true,
+ unsafe_math: true,
+ }
+ input: {
+ var a = [];
+ console.log(false - (a - (a[1] = 42)));
+ }
+ expect: {
+ var a = [];
+ console.log(false - (a - (a[1] = 42)));
+ }
+ expect_stdout: "NaN"
+}
+
+issue_3676_2: {
+ options = {
+ evaluate: true,
+ unsafe_math: true,
+ }
+ input: {
+ var a;
+ console.log(false - ((a = []) - (a[1] = 42)));
+ }
+ expect: {
+ var a;
+ console.log(false - ((a = []) - (a[1] = 42)));
+ }
+ expect_stdout: "NaN"
+}