enable reminify on harmony branch to avoid regressions (#2834)
- can skip known test failures with `reminify: false`
This commit is contained in:
@@ -75,6 +75,7 @@ issue_1664: {
|
||||
}
|
||||
expect_stdout: "1"
|
||||
node_version: ">=6"
|
||||
reminify: false // FIXME - block scoped function
|
||||
}
|
||||
|
||||
issue_1672_for: {
|
||||
|
||||
@@ -60,6 +60,7 @@ dead_code_2_should_warn: {
|
||||
}
|
||||
expect_stdout: true
|
||||
node_version: ">=6"
|
||||
reminify: false // FIXME - block scoped function
|
||||
}
|
||||
|
||||
dead_code_2_should_warn_strict: {
|
||||
@@ -100,6 +101,7 @@ dead_code_2_should_warn_strict: {
|
||||
}
|
||||
expect_stdout: true
|
||||
node_version: ">=4"
|
||||
reminify: false // FIXME - block scoped function
|
||||
}
|
||||
|
||||
dead_code_constant_boolean_should_warn_more: {
|
||||
@@ -135,6 +137,7 @@ dead_code_constant_boolean_should_warn_more: {
|
||||
}
|
||||
expect_stdout: true
|
||||
node_version: ">=6"
|
||||
reminify: false // FIXME - block scoped function
|
||||
}
|
||||
|
||||
dead_code_constant_boolean_should_warn_more_strict: {
|
||||
@@ -171,6 +174,7 @@ dead_code_constant_boolean_should_warn_more_strict: {
|
||||
}
|
||||
expect_stdout: true
|
||||
node_version: ">=4"
|
||||
reminify: false // FIXME - block scoped function
|
||||
}
|
||||
|
||||
dead_code_block_decls_die: {
|
||||
|
||||
@@ -79,6 +79,7 @@ same_variable_in_multiple_forOf: {
|
||||
}
|
||||
}
|
||||
expect_stdout: true
|
||||
reminify: false // FIXME - regression https://github.com/mishoo/UglifyJS2/issues/2835
|
||||
}
|
||||
|
||||
same_variable_in_multiple_forIn: {
|
||||
@@ -120,6 +121,7 @@ same_variable_in_multiple_forIn: {
|
||||
}
|
||||
}
|
||||
expect_stdout: true
|
||||
reminify: false // FIXME - regression https://github.com/mishoo/UglifyJS2/issues/2835
|
||||
}
|
||||
|
||||
different_variable_in_multiple_for_loop: {
|
||||
|
||||
@@ -208,6 +208,9 @@ function run_compress_tests() {
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (test.reminify && !reminify(test.options, input_code, input_formatted, test.expect_stdout)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -261,6 +264,16 @@ function parse_test(file) {
|
||||
}));
|
||||
}
|
||||
|
||||
function read_boolean(stat) {
|
||||
if (stat.TYPE == "SimpleStatement") {
|
||||
var body = stat.body;
|
||||
if (body instanceof U.AST_Boolean) {
|
||||
return body.value;
|
||||
}
|
||||
}
|
||||
throw new Error("Should be boolean");
|
||||
}
|
||||
|
||||
function read_string(stat) {
|
||||
if (stat.TYPE == "SimpleStatement") {
|
||||
var body = stat.body;
|
||||
@@ -279,7 +292,11 @@ function parse_test(file) {
|
||||
}
|
||||
|
||||
function get_one_test(name, block) {
|
||||
var test = { name: name, options: {} };
|
||||
var test = {
|
||||
name: name,
|
||||
options: {},
|
||||
reminify: true,
|
||||
};
|
||||
var tw = new U.TreeWalker(function(node, descend){
|
||||
if (node instanceof U.AST_Assign) {
|
||||
if (!(node.left instanceof U.AST_SymbolRef)) {
|
||||
@@ -299,6 +316,7 @@ function parse_test(file) {
|
||||
"expect_warnings",
|
||||
"expect_stdout",
|
||||
"node_version",
|
||||
"reminify",
|
||||
].indexOf(label.name) >= 0,
|
||||
tmpl("Unsupported label {name} [{line},{col}]", {
|
||||
name: label.name,
|
||||
@@ -309,6 +327,9 @@ function parse_test(file) {
|
||||
var stat = node.body;
|
||||
if (label.name == "expect_exact" || label.name == "node_version") {
|
||||
test[label.name] = read_string(stat);
|
||||
} else if (label.name == "reminify") {
|
||||
var value = read_boolean(stat);
|
||||
test.reminify = value == null || value;
|
||||
} else if (label.name == "expect_stdout") {
|
||||
var body = stat.body;
|
||||
if (body instanceof U.AST_Boolean) {
|
||||
@@ -358,14 +379,17 @@ function evaluate(code) {
|
||||
function reminify(orig_options, input_code, input_formatted, expect_stdout) {
|
||||
for (var i = 0; i < minify_options.length; i++) {
|
||||
var options = JSON.parse(minify_options[i]);
|
||||
if (options.compress) [
|
||||
"keep_fargs",
|
||||
"keep_fnames",
|
||||
].forEach(function(name) {
|
||||
if (name in orig_options) {
|
||||
options.compress[name] = orig_options[name];
|
||||
}
|
||||
});
|
||||
options.keep_fnames = orig_options.keep_fnames;
|
||||
options.keep_classnames = orig_options.keep_classnames;
|
||||
if (orig_options.compress) {
|
||||
options.compress.keep_classnames = orig_options.compress.keep_classnames;
|
||||
options.compress.keep_fargs = orig_options.compress.keep_fargs;
|
||||
options.compress.keep_fnames = orig_options.compress.keep_fnames;
|
||||
}
|
||||
if (orig_options.mangle) {
|
||||
options.mangle.keep_classnames = orig_options.mangle.keep_classnames;
|
||||
options.mangle.keep_fnames = orig_options.mangle.keep_fnames;
|
||||
}
|
||||
var options_formatted = JSON.stringify(options, null, 4);
|
||||
var result = U.minify(input_code, options);
|
||||
if (result.error) {
|
||||
|
||||
Reference in New Issue
Block a user