tests: Add g_resource_has_children() test for empty path

To get the code branch coverage up to 100% because it’s not that hard.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall 2024-09-12 22:53:26 +01:00
parent 6c80db2c24
commit b5cab7c6b9
No known key found for this signature in database
GPG Key ID: DCDF5885B1F3ED73

View File

@ -1056,6 +1056,7 @@ test_resource_has_children (void)
g_assert_true (g_resources_has_children ("/auto_loaded/"));
g_assert_false (g_resources_has_children ("/auto_loaded/test1.txt"));
g_assert_false (g_resources_has_children ("/no/such/prefix"));
g_assert_false (g_resources_has_children (""));
resource = g_resource_load (g_test_get_filename (G_TEST_BUILT, "test.gresource", NULL), &error);
g_assert_nonnull (resource);
@ -1065,6 +1066,7 @@ test_resource_has_children (void)
g_assert_true (g_resource_has_children (resource, "/a_prefix/"));
g_assert_false (g_resource_has_children (resource, "/a_prefix/test2.txt"));
g_assert_false (g_resource_has_children (resource, "/no/such/prefix"));
g_assert_false (g_resource_has_children (resource, ""));
g_resource_unref (resource);
}