Suppress certain stderr-printing during tests

Tests that exercise error paths may result in output to
stderr. This may make it look like the test failed when it did
not. Introduce should_suppress_stderr_for_tests() to suppress
this output so the test output looks clean.
This commit is contained in:
ridiculousfish
2016-12-03 13:27:50 -08:00
parent 254762f30f
commit 754b78a748
5 changed files with 16 additions and 5 deletions

View File

@@ -708,7 +708,8 @@ parse_execution_result_t parse_execution_context_t::report_errors(
parser->get_backtrace(src, error_list, &backtrace_and_desc);
// Print it.
fprintf(stderr, "%ls", backtrace_and_desc.c_str());
if (! should_suppress_stderr_for_tests())
fprintf(stderr, "%ls", backtrace_and_desc.c_str());
}
return parse_execution_errored;
}