Add basic EOF handling to REPL

This commit is contained in:
2024-10-24 19:49:18 +01:00
parent 5ea066b75e
commit b491a1a782
3 changed files with 26 additions and 11 deletions

View File

@@ -97,11 +97,28 @@ static void result_of_evaluation_is_printed_with_a_newline(void)
ASSERT_MEM_EQUAL("4321\n", print_output, 5);
}
static void true_is_returned_on_successful_step(void)
{
set_up_valid_state();
const bool result = step_repl(&repl);
ASSERT_TRUE(result);
}
static void false_is_returned_on_end_of_input(void)
{
set_up_valid_state();
input_len = 0;
const bool result = step_repl(&repl);
ASSERT_FALSE(result);
}
int main(void)
{
TESTING_BEGIN();
RUN_TEST(read_is_called_on_first_line_line_in_input);
RUN_TEST(read_result_is_passed_to_evaluate);
RUN_TEST(result_of_evaluation_is_printed_with_a_newline);
RUN_TEST(true_is_returned_on_successful_step);
RUN_TEST(false_is_returned_on_end_of_input);
TESTING_END();
}