Currently, it is possible to use mock_set_output to put output on stdout which is done by the below lines within the mock.
|
if [[ -e "\${mock}.output.\${call_num}" ]]; then |
|
cat "\${mock}.output.\${call_num}" |
|
else |
|
cat "\${mock}.output" |
|
fi |
This is extremely useful for cases whereby you want to control output to test specific cases of output on stdout, but it means scripts that check what is on stderr are left in a situation that you need to do something like 2>&1 to enable mock_set_output to work in its current form.
It would be really useful to be able to do something like mock_set_stderr "${mock_YOURMOCK}" "message" <optional_call>, which would effectively enable a user to specify both stdout and stderr for specific calls like you already can for mock_set_output
Currently, it is possible to use
mock_set_outputto put output onstdoutwhich is done by the below lines within the mock.bats-mock/src/bats-mock.bash
Lines 40 to 44 in 48fce74
This is extremely useful for cases whereby you want to control output to test specific cases of output on stdout, but it means scripts that check what is on
stderrare left in a situation that you need to do something like2>&1to enablemock_set_outputto work in its current form.It would be really useful to be able to do something like
mock_set_stderr "${mock_YOURMOCK}" "message" <optional_call>, which would effectively enable a user to specify bothstdoutandstderrfor specific calls like you already can formock_set_output