commit fc2f69af5a00b76b45b0c54051b8c061f08cfa42
parent 0f4cf7164be8002ed2cea767c54d13737f55da83
Author: Ed van Bruggen <edvb@uw.edu>
Date: Sat, 16 Nov 2019 23:52:31 -0800
More error checks when running tests
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/test.c b/test.c
@@ -484,14 +484,16 @@ char *tests[][2] = {
int
tisp_test(Env env, const char *input, const char *expect, int output)
{
- struct Str str;
+ struct Str str = { NULL };
Val v;
FILE *f;
size_t nread;
char buf[BUFSIZ] = {0};
- str.d = strdup(input);
- v = tisp_read(env, &str);
+ if (!(str.d = strdup(input)))
+ return 0;
+ if (!(v = tisp_read(env, &str)))
+ return 0;
if (!(v = tisp_eval(env, v))) {
if (output)
putchar('\n');