Update reduce.js
This commit is contained in:
parent
f0ca9cfbe6
commit
6df6772508
|
|
@ -1,8 +1,8 @@
|
||||||
var crypto = require("crypto");
|
let crypto = require("crypto");
|
||||||
var U = require("..");
|
let U = require("..");
|
||||||
var List = U.List;
|
let List = U.List;
|
||||||
var os = require("os");
|
let os = require("os");
|
||||||
var sandbox = require("./sandbox");
|
let sandbox = require("./sandbox");
|
||||||
|
|
||||||
// Reduce a test case by iteratively replacing AST nodes with various
|
// Reduce a test case by iteratively replacing AST nodes with various
|
||||||
// permutations. Each AST_Statement in the tree is also speculatively dropped
|
// permutations. Each AST_Statement in the tree is also speculatively dropped
|
||||||
|
|
@ -20,31 +20,31 @@ Error.stackTraceLimit = Infinity;
|
||||||
module.exports = function reduce_test(testcase, minify_options, reduce_options) {
|
module.exports = function reduce_test(testcase, minify_options, reduce_options) {
|
||||||
minify_options = minify_options || {};
|
minify_options = minify_options || {};
|
||||||
reduce_options = reduce_options || {};
|
reduce_options = reduce_options || {};
|
||||||
var parse_options = {
|
let parse_options = {
|
||||||
module: minify_options.module || minify_options.module === undefined,
|
module: minify_options.module || minify_options.module === undefined,
|
||||||
}
|
}
|
||||||
var print_options = {};
|
let print_options = {};
|
||||||
[
|
[
|
||||||
"ie",
|
"ie",
|
||||||
"v8",
|
"v8",
|
||||||
"webkit",
|
"webkit",
|
||||||
].forEach(function(name) {
|
].forEach(function(name) {
|
||||||
var value = minify_options[name] || minify_options.output && minify_options.output[name];
|
let value = minify_options[name] || minify_options.output && minify_options.output[name];
|
||||||
if (value) print_options[name] = value;
|
if (value) print_options[name] = value;
|
||||||
});
|
});
|
||||||
if (testcase instanceof U.AST_Node) testcase = testcase.print_to_string(print_options);
|
if (testcase instanceof U.AST_Node) testcase = testcase.print_to_string(print_options);
|
||||||
var max_iterations = reduce_options.max_iterations || 1000;
|
let max_iterations = reduce_options.max_iterations || 1000;
|
||||||
var max_timeout = reduce_options.max_timeout || 10000;
|
let max_timeout = reduce_options.max_timeout || 10000;
|
||||||
var warnings = [];
|
let warnings = [];
|
||||||
var log = reduce_options.log || function(msg) {
|
let log = reduce_options.log || function(msg) {
|
||||||
warnings.push(msg);
|
warnings.push(msg);
|
||||||
};
|
};
|
||||||
var verbose = reduce_options.verbose;
|
let verbose = reduce_options.verbose;
|
||||||
var minify_options_json = JSON.stringify(minify_options, null, 2);
|
let minify_options_json = JSON.stringify(minify_options, null, 2);
|
||||||
var result_cache = Object.create(null);
|
let result_cache = Object.create(null);
|
||||||
var test_for_diff = compare_run_code;
|
let test_for_diff = compare_run_code;
|
||||||
// the initial timeout to assess the viability of the test case must be large
|
// the initial timeout to assess the viability of the test case must be large
|
||||||
var differs = test_for_diff(testcase, minify_options, result_cache, max_timeout);
|
let differs = test_for_diff(testcase, minify_options, result_cache, max_timeout);
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
log("// Node.js " + process.version + " on " + os.platform() + " " + os.arch());
|
log("// Node.js " + process.version + " on " + os.platform() + " " + os.arch());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user