diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/main.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/main.c b/tests/main.c index 9b1e40a..1394860 100644 --- a/tests/main.c +++ b/tests/main.c @@ -142,7 +142,10 @@ static void test_load(const char *filepath) { ++num_tests_run; full_path = get_full_path(filepath); - amal_program_init(&program); + if(amal_program_init(&program) != 0) { + fprintf(stderr, "Failed to initialize amal program\n"); + FAIL_TEST(full_path); + } result = amal_compiler_load_file(&options, &program, filepath); if(result != AMAL_COMPILER_OK) { fprintf(stderr, "Failed to load file %s, result: %d\n", full_path, result); @@ -165,7 +168,6 @@ static void test_load_error(const char *filepath, const char *expected_error) { amal_compiler_options options; amal_program program; ErrorExpectedData expected_data; - int result; amal_compiler_options_init(&options); options.num_threads = num_threads; @@ -177,9 +179,11 @@ static void test_load_error(const char *filepath, const char *expected_error) { expected_data.got_expected_error = bool_false; options.error_callback_userdata = &expected_data; - amal_program_init(&program); - result = amal_compiler_load_file(&options, &program, filepath); - if(result == AMAL_COMPILER_OK) { + if(amal_program_init(&program) != 0) { + fprintf(stderr, "Failed to initialize amal program\n"); + FAIL_TEST(expected_data.filepath); + } + if(amal_compiler_load_file(&options, &program, filepath) == AMAL_COMPILER_OK) { fprintf(stderr, "Expected to fail loading file\n"); FAIL_TEST(expected_data.filepath); } |