4 ms·
I mostly agree with you, but I would like to make something clear. >I'm also tempted to say that if you need to use GDB to figure out where your tests have fai
by ainar-g 8y ago
I mostly agree with you, but I would like to make something clear.
>I'm also tempted to say that if you need to use GDB to figure out where your tests have failed exactly your framework is not particularly user friendly.
Am I missing something?
#include <assert.h>
int main(void)
{
assert(0);
return 0;
}
When using clang I get a clear message that includes the filename, the line, and the function:
assert.bin: assert.c:5: int main(void): Assertion `0' failed.
- simias 8y agoMy point was that depending on how you structure your tests knowing the location of the assert might not help you, for instance you could have a helper function that would validate something and generate a failure if something goes wrong, in this case knowing that this specific function failed doesn't help much understanding what test specifically failed. My point was that if you need GDB to figure out what exactly failed then you don't have a very user friendly test framework.
- ainar-g 8y agoOh, I see now. Yeah, trying to make assert output a dynamically constructed message does seem like a PITA.