mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-14 19:55:12 +01:00
tests: Skip vasprintf() placeholder checks on FreeBSD and macOS
The `vasprintf()` version on those platforms seems to do less rigorous checking of format placeholders. See https://gitlab.gnome.org/GNOME/glib/-/jobs/1890001 and https://gitlab.gnome.org/GNOME/glib/-/jobs/1890000. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
1094144b7a
commit
dbe34687d0
@ -895,6 +895,7 @@ test_upper_bound (void)
|
|||||||
g_assert_cmpint (res, ==, 20);
|
g_assert_cmpint (res, ==, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||||
static gint test_vasprintf_va (gchar **string,
|
static gint test_vasprintf_va (gchar **string,
|
||||||
const gchar *format,
|
const gchar *format,
|
||||||
...) G_GNUC_PRINTF (2, 3);
|
...) G_GNUC_PRINTF (2, 3);
|
||||||
@ -914,15 +915,19 @@ test_vasprintf_va (gchar **string,
|
|||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
#endif /* !defined(__APPLE__) && !defined(__FreeBSD__) */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_vasprintf_invalid_format_placeholder (void)
|
test_vasprintf_invalid_format_placeholder (void)
|
||||||
{
|
{
|
||||||
|
#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||||
gint len = 0;
|
gint len = 0;
|
||||||
gchar *buf = "some non-null string";
|
gchar *buf = "some non-null string";
|
||||||
|
#endif
|
||||||
|
|
||||||
g_test_summary ("Test error handling for invalid format placeholder in g_vasprintf()");
|
g_test_summary ("Test error handling for invalid format placeholder in g_vasprintf()");
|
||||||
|
|
||||||
|
#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wformat"
|
#pragma GCC diagnostic ignored "-Wformat"
|
||||||
#pragma GCC diagnostic ignored "-Wformat-extra-args"
|
#pragma GCC diagnostic ignored "-Wformat-extra-args"
|
||||||
@ -931,6 +936,9 @@ test_vasprintf_invalid_format_placeholder (void)
|
|||||||
|
|
||||||
g_assert_cmpint (len, ==, -1);
|
g_assert_cmpint (len, ==, -1);
|
||||||
g_assert_null (buf);
|
g_assert_null (buf);
|
||||||
|
#else
|
||||||
|
g_test_skip ("vasprintf() placeholder checks on BSDs are less strict");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user