commit 0dd37753d162135b18f0b85c7e67db0e18165a95
parent eee745b443361fa93086ade60b349caab25b10f1
Author: Ed van Bruggen <edvb@uw.edu>
Date: Tue, 26 Mar 2019 16:57:40 -0700
Close and remove test file
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/test.c b/test.c
@@ -253,7 +253,7 @@ tisp_test(Env env, const char *input, const char *expect, int output)
{
struct Str str;
Val v;
- FILE *f = fopen("test.out", "w");
+ FILE *f;
size_t nread;
char buf[BUFSIZ] = {0};
@@ -265,10 +265,14 @@ tisp_test(Env env, const char *input, const char *expect, int output)
return 0;
}
+ f = fopen("test.out", "w");
tisp_print(f, v);
fclose(f);
+
f = fopen("test.out", "r");
while ((nread = fread(buf, 1, sizeof(buf), f)) > 0) ;
+ fclose(f);
+ remove("test.out");
if (output)
printf("%s\n", buf);