libcester
libcester copied to clipboard
Issue with capturing stderr stream
I have an issue with this code
CESTER_CAPTURE_STDERR();
__wrap_infrsprin_(&n,rp,ip,c,&torq1);
cester_assert_stderr_stream_content_contain("constraint");
CESTER_RELEASE_STDERR();
that seems to not capture stderr stream content
You can use the macro CESTER_STDERR_CONTENT to print out the stderr content to see if anything is in it
printf("%s", CESTER_STDERR_CONTENT())
Or verify the output stream the function is printing into, if it is not stderr you can capture the stream manually
// stream can be stdout, stderr, a FILE handle, etc.
CESTER_CAPTURE_STREAM(stream);
__wrap_infrsprin_(&n,rp,ip,c,&torq1);
cester_assert_stream_content_contain(stream, "constraint");
CESTER_RELEASE_STREAM(stream);
I assume the function _wrap_infrsprin prints to a stream in the course of it execution.
The stderr content is not print out and cester do not capture any type of file handle or even stdout