aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/compress/numbers.js20
-rw-r--r--test/ufuzz/index.js10
2 files changed, 26 insertions, 4 deletions
diff --git a/test/compress/numbers.js b/test/compress/numbers.js
index 7946ba8a..63a100b7 100644
--- a/test/compress/numbers.js
+++ b/test/compress/numbers.js
@@ -713,7 +713,7 @@ issue_3531_1: {
}
expect: {
var a = "1";
- console.log(typeof (a + 1 - (.2 + .1)));
+ console.log(typeof (a + 1 - .3));
}
expect_stdout: "number"
}
@@ -747,3 +747,21 @@ issue_3531_3: {
}
expect_stdout: "-22"
}
+
+issue_3536: {
+ options = {
+ evaluate: true,
+ unsafe_math: true,
+ }
+ input: {
+ var a = 100, b = 10;
+ var c = --a + ("23" - (b++, 1));
+ console.log(typeof c, a, b, c);
+ }
+ expect: {
+ var a = 100, b = 10;
+ var c = --a + ("23" - (b++, 1));
+ console.log(typeof c, a, b, c);
+ }
+ expect_stdout: "number 99 11 121"
+}
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);