Test reparsing test/compress/*.js output
This commit is contained in:
@@ -132,7 +132,20 @@ function run_compress_tests() {
|
|||||||
failures++;
|
failures++;
|
||||||
failed_files[file] = 1;
|
failed_files[file] = 1;
|
||||||
}
|
}
|
||||||
else if (test.expect_warnings) {
|
else {
|
||||||
|
// expect == output
|
||||||
|
try {
|
||||||
|
var reparsed_ast = U.parse(output);
|
||||||
|
} catch (ex) {
|
||||||
|
log("!!! Test matched expected result but cannot parse output\n---INPUT---\n{input}\n---OUTPUT---\n{output}\n--REPARSE ERROR--\n{error}\n\n", {
|
||||||
|
input: input_code,
|
||||||
|
output: output,
|
||||||
|
error: ex.toString(),
|
||||||
|
});
|
||||||
|
failures++;
|
||||||
|
failed_files[file] = 1;
|
||||||
|
}
|
||||||
|
if (test.expect_warnings) {
|
||||||
U.AST_Node.warn_function = original_warn_function;
|
U.AST_Node.warn_function = original_warn_function;
|
||||||
var expected_warnings = make_code(test.expect_warnings, {
|
var expected_warnings = make_code(test.expect_warnings, {
|
||||||
beautify: false,
|
beautify: false,
|
||||||
@@ -153,6 +166,7 @@ function run_compress_tests() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
var tests = parse_test(path.resolve(dir, file));
|
var tests = parse_test(path.resolve(dir, file));
|
||||||
for (var i in tests) if (tests.hasOwnProperty(i)) {
|
for (var i in tests) if (tests.hasOwnProperty(i)) {
|
||||||
test_case(tests[i]);
|
test_case(tests[i]);
|
||||||
|
|||||||
Reference in New Issue
Block a user