From e7d9456c90d63871d0f41a542beb48d712ee5c20 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 13 Oct 2022 13:39:48 +0100 Subject: [PATCH] =?UTF-8?q?tests:=20Don=E2=80=99t=20rely=20on=20output=20l?= =?UTF-8?q?ocale=20of=20sort=20in=20spawn-test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise the test will fail when run in a non-English locale. Fix suggested by Simon McVittie. Signed-off-by: Philip Withnall Bug: https://gitlab.gnome.org/GNOME/glib/-/issues/2754 Origin: upstream, 2.75.0, commit:360fc4cda351705102e72e1eeb3c4385fa7fda62 --- glib/tests/spawn-test.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/glib/tests/spawn-test.c b/glib/tests/spawn-test.c index 4e54ab2..e4f2efc 100644 --- a/glib/tests/spawn-test.c +++ b/glib/tests/spawn-test.c @@ -31,6 +31,7 @@ #include #include #define pipe(fds) _pipe(fds, 4096, _O_BINARY) +#include #endif #ifdef G_OS_WIN32 @@ -109,8 +110,16 @@ test_spawn_basics (void) NULL, &erroutput, NULL, &err); g_assert_no_error (err); g_assert_true (result); +#ifndef G_OS_WIN32 g_assert_true (g_str_has_prefix (erroutput, "sort: ")); - g_assert_nonnull (strstr (erroutput, "No such file or directory")); + g_assert_nonnull (strstr (erroutput, g_strerror (ENOENT))); +#else + { + gchar *file_not_found_message = g_win32_error_message (ERROR_FILE_NOT_FOUND); + g_assert_nonnull (strstr (erroutput, file_not_found_message)); + g_free (file_not_found_message); + } +#endif g_free (erroutput); erroutput = NULL;