[glib: 2/4] tests: Test that g_bytes_unref(NULL) is a no-op
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 2/4] tests: Test that g_bytes_unref(NULL) is a no-op
- Date: Wed, 16 Jun 2021 13:51:41 +0000 (UTC)
commit fc7b316bc7b236bb1d21b1337196515de4053c47
Author: Philip Withnall <pwithnall endlessos org>
Date: Fri Jun 11 12:14:06 2021 +0100
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>
glib/tests/bytes.c | 8 ++++++++
1 file changed, 8 insertions(+)
---
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 ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]