From 1be326911c082443407d60da6317f237992732e3 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Mon, 23 Feb 2026 17:23:54 +0100 Subject: [PATCH] tests: Improve autocomplete unit tests It seems like we didn't even check whether the operations succeed or not. * `clear_empty()` Add assertion to confirm a newly created autocomplete object is empty. * `find_after_create()`: Add assertion to ensure `autocomplete_complete()` returns NULL when no entries are present in th object. --- tests/unittests/test_autocomplete.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/unittests/test_autocomplete.c b/tests/unittests/test_autocomplete.c index 3988aaa4..0377fe87 100644 --- a/tests/unittests/test_autocomplete.c +++ b/tests/unittests/test_autocomplete.c @@ -9,7 +9,10 @@ void clear_empty(void** state) { Autocomplete ac = autocomplete_new(); + char* result = autocomplete_complete(ac, "test", TRUE, FALSE); + assert_null(result); autocomplete_free(ac); + free(result); } void @@ -25,6 +28,7 @@ find_after_create(void** state) { Autocomplete ac = autocomplete_new(); char* result = autocomplete_complete(ac, "hello", TRUE, FALSE); + assert_null(result); autocomplete_free(ac); free(result); }