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.
This commit is contained in:
Michael Vetter
2026-02-23 17:23:54 +01:00
parent 657de5f22f
commit 1be326911c

View File

@@ -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);
}