aboutsummaryrefslogtreecommitdiff
path: root/test/ufuzz/index.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-10-28 13:37:08 +0800
committerGitHub <noreply@github.com>2019-10-28 13:37:08 +0800
commit2f3b46021239c88e4eb38a8d26ae105aaf78d2d1 (patch)
treeb725db253b0c0a45a91242fb38991da7db85624f /test/ufuzz/index.js
parent06e135e35f688cc2527a92fd30c9a30f119805bd (diff)
downloadtracifyjs-2f3b46021239c88e4eb38a8d26ae105aaf78d2d1.tar.gz
tracifyjs-2f3b46021239c88e4eb38a8d26ae105aaf78d2d1.zip
fix & enhance `unsafe_math` (#3537)
closes #3535 fixes #3536
Diffstat (limited to 'test/ufuzz/index.js')
-rw-r--r--test/ufuzz/index.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js
index c71dbb39..e6ee3fde 100644
--- a/test/ufuzz/index.js
+++ b/test/ufuzz/index.js
@@ -1050,16 +1050,20 @@ function log_rename(options) {
}
}
+function orig_code(unsafe_math) {
+ return unsafe_math ? original_code.replace(/( - 0\.1){3}/g, " - 0.3") : original_code;
+}
+
function log(options) {
+ options = JSON.parse(options);
if (!ok) errorln("\n\n\n\n\n\n!!!!!!!!!!\n\n\n");
errorln("//=============================================================");
if (!ok) errorln("// !!!!!! Failed... round " + round);
errorln("// original code");
- try_beautify(original_code, false, original_result, errorln);
+ try_beautify(orig_code(options.compress.unsafe_math), options.toplevel, original_result, errorln);
errorln();
errorln();
errorln("//-------------------------------------------------------------");
- options = JSON.parse(options);
if (typeof uglify_code == "string") {
errorln("// uglified code");
try_beautify(uglify_code, options.toplevel, uglify_result, errorln);
@@ -1103,7 +1107,7 @@ for (var round = 1; round <= num_iterations; round++) {
var orig_result = [ sandbox.run_code(original_code) ];
errored = typeof orig_result[0] != "string";
if (!errored) {
- orig_result.push(sandbox.run_code(original_code, true), sandbox.run_code(original_code.replace(/( - 0\.1){3}/g, " - 0.3")));
+ orig_result.push(sandbox.run_code(original_code, true), sandbox.run_code(orig_code(true)));
}
(errored ? fallback_options : minify_options).forEach(function(options) {
var o = JSON.parse(options);