interpret/test/test_text.c

21 lines
446 B
C
Raw Permalink Normal View History

2022-12-27 07:31:08 +00:00
#include "../src/text.h"
#include <stdlib.h>
#include <stdio.h>
2023-03-11 04:06:11 +00:00
#include <errno.h>
2022-12-27 07:31:08 +00:00
int main(void) {
struct char_array t = text();
2022-12-27 07:31:08 +00:00
char *content;
int success = EXIT_SUCCESS;
2023-03-11 04:06:11 +00:00
errno = 0; /* `errno` is not set correctly to 0 in some debug situations. */
2022-12-27 07:31:08 +00:00
if(!(content = text_append_file(&t, "Makefile"))) goto catch;
printf("%s", content);
goto finally;
catch:
success = EXIT_FAILURE;
perror("text");
finally:
text_(&t);
return success;
}