@@ -4273,8 +4273,8 @@ issue_2436_14: {
|
||||
var b = {};
|
||||
(function() {
|
||||
a && function(c, d) {
|
||||
console.log(c, d);
|
||||
}(b, a);
|
||||
console.log(b, d);
|
||||
}(0, a);
|
||||
})();
|
||||
}
|
||||
expect_stdout: true
|
||||
|
||||
@@ -974,3 +974,41 @@ issue_4444: {
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
issue_4446_1: {
|
||||
options = {
|
||||
collapse_vars: true,
|
||||
}
|
||||
input: {
|
||||
a = 42;
|
||||
[ b = 42 ] = [ "PASS" ];
|
||||
c = 42;
|
||||
console.log(b, a);
|
||||
}
|
||||
expect: {
|
||||
[ b = 42 ] = [ "PASS" ];
|
||||
c = a = 42;
|
||||
console.log(b, a);
|
||||
}
|
||||
expect_stdout: "PASS 42"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
issue_4446_2: {
|
||||
options = {
|
||||
collapse_vars: true,
|
||||
}
|
||||
input: {
|
||||
a = 42;
|
||||
var [ b = 42 ] = [ "PASS" ];
|
||||
c = 42;
|
||||
console.log(b, a);
|
||||
}
|
||||
expect: {
|
||||
var [ b = 42 ] = [ "PASS" ];
|
||||
c = a = 42;
|
||||
console.log(b, a);
|
||||
}
|
||||
expect_stdout: "PASS 42"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
@@ -2146,3 +2146,21 @@ issue_4436_undefined: {
|
||||
expect_stdout: true
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
issue_4446: {
|
||||
options = {
|
||||
collapse_vars: true,
|
||||
}
|
||||
input: {
|
||||
a = "PASS";
|
||||
var a = [ a[0] ] = [ a ];
|
||||
console.log(a[0]);
|
||||
}
|
||||
expect: {
|
||||
a = "PASS";
|
||||
var a = [ a[0] ] = [ a ];
|
||||
console.log(a[0]);
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
@@ -153,6 +153,20 @@ module.exports = function reduce_test(testcase, minify_options, reduce_options)
|
||||
node.left,
|
||||
node.right,
|
||||
][ permute & 1 ];
|
||||
if (expr instanceof U.AST_Destructured) expr = expr.transform(new U.TreeTransformer(function(node, descend) {
|
||||
if (node instanceof U.AST_DefaultValue) return new U.AST_Assign({
|
||||
operator: "=",
|
||||
left: node.name.transform(this),
|
||||
right: node.value,
|
||||
start: {},
|
||||
});
|
||||
if (node instanceof U.AST_DestructuredKeyVal) return new U.AST_ObjectKeyVal(node);
|
||||
if (node instanceof U.AST_Destructured) {
|
||||
node = new (node instanceof U.AST_DestructuredArray ? U.AST_Array : U.AST_Object)(node);
|
||||
descend(node, this);
|
||||
}
|
||||
return node;
|
||||
}));
|
||||
CHANGED = true;
|
||||
return permute < 2 ? expr : wrap_with_console_log(expr);
|
||||
}
|
||||
|
||||
@@ -1680,18 +1680,20 @@ function log(options) {
|
||||
}
|
||||
}
|
||||
errorln("//-------------------------------------------------------------");
|
||||
var reduce_options = JSON.parse(options);
|
||||
reduce_options.validate = true;
|
||||
var reduced = reduce_test(original_code, reduce_options, {
|
||||
verbose: false,
|
||||
}).code;
|
||||
if (reduced) {
|
||||
errorln();
|
||||
errorln("// reduced test case (output will differ)");
|
||||
errorln();
|
||||
errorln(reduced);
|
||||
errorln();
|
||||
errorln("//-------------------------------------------------------------");
|
||||
if (!ok) {
|
||||
var reduce_options = JSON.parse(options);
|
||||
reduce_options.validate = true;
|
||||
var reduced = reduce_test(original_code, reduce_options, {
|
||||
verbose: false,
|
||||
}).code;
|
||||
if (reduced) {
|
||||
errorln();
|
||||
errorln("// reduced test case (output will differ)");
|
||||
errorln();
|
||||
errorln(reduced);
|
||||
errorln();
|
||||
errorln("//-------------------------------------------------------------");
|
||||
}
|
||||
}
|
||||
errorln("minify(options):");
|
||||
errorln(JSON.stringify(JSON.parse(options), null, 2));
|
||||
|
||||
@@ -70,7 +70,7 @@ function run() {
|
||||
|
||||
function trap(data) {
|
||||
stderr += data;
|
||||
if (~stderr.indexOf("\nminify(options):\n")) {
|
||||
if (~stderr.indexOf("!!!!!! Failed... round ")) {
|
||||
process.exitCode = 1;
|
||||
child.stderr.removeListener("data", trap);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user