aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-11-18 13:44:13 +0800
committerGitHub <noreply@github.com>2019-11-18 13:44:13 +0800
commit644f65feca92d03076c57a6a078dc9c35a82fadb (patch)
tree3e0eebe2689d57c72662952040b6e91ec44590f2 /test
parent8504a4ea0eddeb759f6f762f4ee46e5dde5f8e07 (diff)
downloadtracifyjs-644f65feca92d03076c57a6a078dc9c35a82fadb.tar.gz
tracifyjs-644f65feca92d03076c57a6a078dc9c35a82fadb.zip
fix corner case in `unsafe_math` (#3594)
fixes #3593
Diffstat (limited to 'test')
-rw-r--r--test/compress/numbers.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/test/compress/numbers.js b/test/compress/numbers.js
index ee20fc15..1203412a 100644
--- a/test/compress/numbers.js
+++ b/test/compress/numbers.js
@@ -870,7 +870,7 @@ issue_3547_3: {
a + "21",
a + "2" - 1,
a - 1,
- a - "2" - 1,
+ a - 3,
].forEach(function(n) {
console.log(typeof n, n);
});
@@ -904,7 +904,7 @@ issue_3547_4: {
[
"3" + a + 1,
"3" + a - 1,
- "3" - a + 1,
+ 4 - a,
2 - a,
].forEach(function(n) {
console.log(typeof n, n);
@@ -931,3 +931,17 @@ unsafe_math_rounding: {
}
expect_stdout: "false"
}
+
+issue_3593: {
+ options = {
+ evaluate: true,
+ unsafe_math: true,
+ }
+ input: {
+ console.log((0 === this) - 1 - "1");
+ }
+ expect: {
+ console.log((0 === this) - 2);
+ }
+ expect_stdout: "-2"
+}