test_history.c

Test suite for the shell history module.

Tests history_file_path() POSIX lookup order ($HISTFILE → $HOME/.sh_history) and the history_save() / history_load() file round-trip via readline’s in-memory history list (history_list(), history_length, clear_history()).

Author

pulgamecanica (arosado-)

Guarded by TEST_HISTORY_ENABLED (set in TEST_FLAGS in the root Makefile). Once all assertions pass permanently, remove the #ifdef guards and the -D flag from the Makefile.

Functions

void test_history_suite(void)

Run all history module assertions.

  • history_file_path: $HISTFILE takes priority.

  • history_file_path: falls back to $HOME/.sh_history when $HISTFILE unset.

  • history_save / history_load round-trip preserves all entries.