tests: Test g_str_has_prefix inside G_UNLIKELY

g_str_has_prefix uses G_UNLIKELY itself, and up
until recently, G_UNLIKELY could not be nested.

This commit adds a test that nests G_UNLIKELY to
make sure it continues to work going forward.
This commit is contained in:
Ray Strode 2022-11-04 15:02:34 -04:00
parent 73bd146409
commit 69b410c58a

View File

@ -1264,6 +1264,9 @@ test_has_prefix_macro (void)
g_assert_true (g_str_has_prefix ("foo", ""));
g_assert_true (g_str_has_prefix ("foo", "foo"));
g_assert_true (g_str_has_prefix ("", ""));
/* Testing the nested G_UNLIKELY */
g_assert_false (G_UNLIKELY (g_str_has_prefix ("foo", "aaa")));
}
/* Testing g_str_has_suffix() function avoiding the optimizing macro */