[glib/halfline/test-case-pipe-confusion: 2/7] tests: Don’t rely on output locale of sort in spawn-test
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/halfline/test-case-pipe-confusion: 2/7] tests: Don’t rely on output locale of sort in spawn-test
- Date: Mon, 17 Oct 2022 19:15:34 +0000 (UTC)
commit 6bb817e10ee86e7877c384e3b137b664e8c6dd96
Author: Philip Withnall <pwithnall endlessos org>
Date: Thu Oct 13 13:39:48 2022 +0100
tests: Don’t rely on output locale of sort in spawn-test
Otherwise the test will fail when run in a non-English locale.
Fix suggested by Simon McVittie.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
Fixes: #2754
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 44d585dcfe..252c35141f 100644
--- a/glib/tests/spawn-test.c
+++ b/glib/tests/spawn-test.c
@@ -31,6 +31,7 @@
#include <fcntl.h>
#include <io.h>
#define pipe(fds) _pipe(fds, 4096, _O_BINARY)
+#include <WinError.h>
#endif
#ifdef G_OS_WIN32
@@ -112,8 +113,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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]