Improved error reporting for builtin_test

This commit is contained in:
ridiculousfish 2012-03-07 01:02:46 -08:00
parent ed7c10f366
commit 6788c2710f
3 changed files with 10 additions and 0 deletions

View file

@ -129,6 +129,10 @@ const wcstring &get_stderr_buffer() {
return stderr_buffer;
}
void builtin_show_error(const wcstring &err) {
ASSERT_IS_MAIN_THREAD();
stderr_buffer.append(err);
}
/**
Stack containing builtin I/O for recursive builtin calls.

View file

@ -94,6 +94,9 @@ enum
const wcstring &get_stdout_buffer();
const wcstring &get_stderr_buffer();
/** Output an error */
void builtin_show_error(const wcstring &err);
/**
Kludge. Tells builtins if output is to screen
*/

View file

@ -595,11 +595,14 @@ int builtin_test( parser_t &parser, wchar_t **argv )
wcstring err;
expression *expr = test_parser::parse_args(args, err);
if (! expr) {
#if 0
printf("Oops! test was given args:\n");
for (size_t i=0; i < argc; i++) {
printf("\t%ls\n", args.at(i).c_str());
}
printf("and returned parse error: %ls\n", err.c_str());
#endif
builtin_show_error(err);
return BUILTIN_TEST_FAIL;
} else {
wcstring_list_t eval_errors;