diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/check_reader.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/test/check_reader.c b/src/test/check_reader.c index 8769cd7..3184e41 100644 --- a/src/test/check_reader.c +++ b/src/test/check_reader.c @@ -6,7 +6,6 @@ #include "../grammar.h" #include "../reader.h" -/* TODO: check string */ int main(U_ATTR int argc, U_ATTR char **argv) { @@ -17,7 +16,7 @@ main(U_ATTR int argc, U_ATTR char **argv) NUM buffer_size = 0; if (read_entire_file(file_name, &buffer, &buffer_size)) { - fleprintf("%s:%d, Cannot read file %s", file_name); + fleprintf("Cannot read file %s", file_name); free(buffer); return 1; } @@ -26,9 +25,13 @@ main(U_ATTR int argc, U_ATTR char **argv) Grammar *g = read_grammar_from_bnf((str *) s); - print_grammar(g); - destroy_grammar(g, 2); - destroy_str((str *)s, 1); + if (g) { + print_grammar(g); + destroy_grammar(g, 2); + destroy_str((str *)s, 1); - return 0; + return 0; + } + + return 1; } |