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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user