diff options
author | Philip Withnall <pwithnall@endlessos.org> | 2021-06-11 12:14:06 +0100 |
---|---|---|
committer | Philip Withnall <pwithnall@endlessos.org> | 2021-06-16 12:14:57 +0100 |
commit | fc7b316bc7b236bb1d21b1337196515de4053c47 (patch) | |
tree | 1e4f312d90d8dcd726136c880a323bce6843cbf2 | |
parent | 082c2117bb72909bf1728b24b523af06ab2dcdca (diff) | |
download | glib-fc7b316bc7b236bb1d21b1337196515de4053c47.tar.gz |
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>
-rw-r--r-- | glib/tests/bytes.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/glib/tests/bytes.c b/glib/tests/bytes.c index 6b86cc197..534687fe6 100644 --- a/glib/tests/bytes.c +++ b/glib/tests/bytes.c @@ -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 (); } |