diff options
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/comparing.js | 39 | ||||
-rw-r--r-- | test/compress/evaluate.js | 37 |
2 files changed, 75 insertions, 1 deletions
diff --git a/test/compress/comparing.js b/test/compress/comparing.js index c51fac31..11804cbb 100644 --- a/test/compress/comparing.js +++ b/test/compress/comparing.js @@ -73,4 +73,41 @@ dont_change_in_or_instanceof_expressions: { 1 instanceof 1; null instanceof null; } -}
\ No newline at end of file +} + +self_comparison_1: { + options = { + comparisons: true, + } + input: { + a === a; + a !== b; + b.c === a.c; + b.c !== b.c; + } + expect: { + a == a; + a !== b; + b.c === a.c; + b.c != b.c; + } +} + +self_comparison_2: { + options = { + comparisons: true, + reduce_vars: true, + toplevel: true, + } + input: { + function f() {} + var o = {}; + console.log(f != f, o === o); + } + expect: { + function f() {} + var o = {}; + console.log(false, true); + } + expect_stdout: "false true" +} diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js index fe9464bc..dc8ceb62 100644 --- a/test/compress/evaluate.js +++ b/test/compress/evaluate.js @@ -1195,3 +1195,40 @@ issue_2231_2: { } expect_stdout: true } + +self_comparison_1: { + options = { + evaluate: true, + reduce_vars: true, + toplevel: true, + unsafe: true, + unused: true, + } + input: { + var o = { n: NaN }; + console.log(o.n == o.n, o.n === o.n, o.n != o.n, o.n !== o.n, typeof o.n); + } + expect: { + console.log(false, false, true, true, "number"); + } + expect_stdout: "false false true true 'number'" +} + +self_comparison_2: { + options = { + evaluate: true, + hoist_props: true, + passes: 2, + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + var o = { n: NaN }; + console.log(o.n == o.n, o.n === o.n, o.n != o.n, o.n !== o.n, typeof o.n); + } + expect: { + console.log(false, false, true, true, "number"); + } + expect_stdout: "false false true true 'number'" +} |