1
0
mirror of https://gitlab.gnome.org/GNOME/glib.git synced 2025-07-12 05:28:50 +02:00

tests: Fix string test failure on BSDs

As with `test-printf`, the `vasprintf()` placeholder checks on BSDs
(including macOS) are less strict than on Linux (glibc), so the expected
critical message is not seen.

Change the test to not expect it on BSDs.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: 
This commit is contained in:
Philip Withnall
2023-11-27 13:26:51 +00:00
parent 062f1a888e
commit 2c4be841d7

@ -319,6 +319,8 @@ test_string_append_vprintf (void)
string_append_vprintf_va (string, "some %s placeholders", "format"); string_append_vprintf_va (string, "some %s placeholders", "format");
/* vasprintf() placeholder checks on BSDs are less strict, so skip these checks if so */
#if !defined(__APPLE__) && !defined(__FreeBSD__)
if (g_test_undefined ()) if (g_test_undefined ())
{ {
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
@ -330,6 +332,7 @@ test_string_append_vprintf (void)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
g_test_assert_expected_messages (); g_test_assert_expected_messages ();
} }
#endif
g_assert_cmpstr (string->str, ==, "firsthalfsome format placeholders"); g_assert_cmpstr (string->str, ==, "firsthalfsome format placeholders");