diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-10-26 10:53:58 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-26 18:53:58 +0800 |
commit | 607f87c5cde7f4f66a43e5986ca692e7f7861f57 (patch) | |
tree | a1ffa23cb31155a569974300837af19833deae61 /test | |
parent | b2775746a7d7bc3a52dfdce43aa2f281ef6e7f6e (diff) | |
download | tracifyjs-607f87c5cde7f4f66a43e5986ca692e7f7861f57.tar.gz tracifyjs-607f87c5cde7f4f66a43e5986ca692e7f7861f57.zip |
fix corner case in `booleans` (#4246)
fixes #4245
Diffstat (limited to 'test')
-rw-r--r-- | test/compress.js | 2 | ||||
-rw-r--r-- | test/compress/const.js | 20 | ||||
-rw-r--r-- | test/compress/let.js | 23 |
3 files changed, 44 insertions, 1 deletions
diff --git a/test/compress.js b/test/compress.js index 77b09f0d..3d9b1a63 100644 --- a/test/compress.js +++ b/test/compress.js @@ -386,7 +386,7 @@ function test_case(test) { mangle: test.mangle }); var actual = stdout[toplevel ? 1 : 0]; - if (test.expect_stdout === true) { + if (test.expect_stdout === true || test.expect_stdout instanceof Error && test.expect_stdout.name === actual.name) { test.expect_stdout = actual; } if (!sandbox.same_stdout(test.expect_stdout, actual)) { diff --git a/test/compress/const.js b/test/compress/const.js index 694c9d16..2f88975e 100644 --- a/test/compress/const.js +++ b/test/compress/const.js @@ -1084,3 +1084,23 @@ issue_4231: { } expect_stdout: "function" } + +issue_4245: { + options = { + booleans: true, + } + input: { + const a = f(); + function f() { + typeof a; + } + } + expect: { + const a = f(); + function f() { + a, + 1; + } + } + expect_stdout: true +} diff --git a/test/compress/let.js b/test/compress/let.js index 8374db9a..deb48120 100644 --- a/test/compress/let.js +++ b/test/compress/let.js @@ -893,3 +893,26 @@ issue_4231: { expect_stdout: "function" node_version: ">=4" } + +issue_4245: { + options = { + booleans: true, + } + input: { + "use strict"; + let a = f(); + function f() { + typeof a; + } + } + expect: { + "use strict"; + let a = f(); + function f() { + a, + 1; + } + } + expect_stdout: ReferenceError("a is not defined") + node_version: ">=4" +} |