tests: Test that g_bytes_unref(NULL) is a no-op

It’s documented as such, and this marginally increases the code coverage
on `gbytes.c`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall 2021-06-11 12:14:06 +01:00
parent 082c2117bb
commit fc7b316bc7

View File

@ -450,6 +450,13 @@ test_get_region (void)
g_bytes_unref (bytes);
}
static void
test_unref_null (void)
{
g_test_summary ("Test that calling g_bytes_unref() on NULL is a no-op");
g_bytes_unref (NULL);
}
int
main (int argc, char *argv[])
{
@ -474,6 +481,7 @@ main (int argc, char *argv[])
g_test_add_func ("/bytes/to-array/non-malloc", test_to_array_non_malloc);
g_test_add_func ("/bytes/null", test_null);
g_test_add_func ("/bytes/get-region", test_get_region);
g_test_add_func ("/bytes/unref-null", test_unref_null);
return g_test_run ();
}