diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/const.js | 29 | ||||
-rw-r--r-- | test/ufuzz/index.js | 2 |
2 files changed, 30 insertions, 1 deletions
diff --git a/test/compress/const.js b/test/compress/const.js index 6cd1124a..f2b92247 100644 --- a/test/compress/const.js +++ b/test/compress/const.js @@ -776,3 +776,32 @@ issue_4195: { } expect_stdout: "undefined" } + +issue_4197: { + options = { + collapse_vars: true, + } + input: { + var a = 0; + try { + const b = function() { + a = 1; + b[1]; + }(); + } catch (e) { + console.log(a); + } + } + expect: { + var a = 0; + try { + const b = function() { + a = 1; + b[1]; + }(); + } catch (e) { + console.log(a); + } + } + expect_stdout: "1" +} diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js index 717252d3..3e2d865d 100644 --- a/test/ufuzz/index.js +++ b/test/ufuzz/index.js @@ -1348,7 +1348,7 @@ for (var round = 1; round <= num_iterations; round++) { ok = sandbox.same_stdout(sandbox.run_code(sort_globals(original_code)), sandbox.run_code(sort_globals(uglify_code))); } // ignore numerical imprecision caused by `unsafe_math` - if (!ok && typeof uglify_result == "string" && o.compress && o.compress.unsafe_math) { + if (!ok && o.compress && o.compress.unsafe_math && typeof original_result == "string" && typeof uglify_result == "string") { ok = fuzzy_match(original_result, uglify_result); if (!ok) { var fuzzy_result = sandbox.run_code(original_code.replace(/( - 0\.1){3}/g, " - 0.3"), toplevel); |