From 6e224f7677e80a53aa43c92e10659fb700e0154a Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Tue, 5 Feb 2019 22:18:40 +0800 Subject: [PATCH] glib/tests/convert.c: Skip tests that aren't meaningful for Windows On Windows, everything is assumed as UTF-8 in g_get_filename_charsets(), so setting G_FILENAME_ENCODING envvar has no effect, so we can just skip the test on g_get_filename_charsets() where we try to influence it by setting the G_FILENAME_ENCODING envvar. --- glib/tests/convert.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/glib/tests/convert.c b/glib/tests/convert.c index 5ffee6162..c43b3db6e 100644 --- a/glib/tests/convert.c +++ b/glib/tests/convert.c @@ -827,8 +827,11 @@ test_filename_to_utf8_embedded_nul_utf8 (void) gsize bytes_read; GError *error = NULL; +#ifndef G_OS_WIN32 + /* G_FILENAME_ENCODING has no effect on Windows for g_get_filename_charsets() */ g_setenv ("G_FILENAME_ENCODING", "UTF-8", TRUE); g_assert_true (g_get_filename_charsets (NULL)); +#endif res = g_filename_to_utf8 ("ab\0c", 4, &bytes_read, NULL, &error); @@ -848,8 +851,11 @@ test_filename_to_utf8_embedded_nul_iconv (void) gsize bytes_read; GError *error = NULL; +#ifndef G_OS_WIN32 + /* G_FILENAME_ENCODING has no effect on Windows for g_get_filename_charsets() */ g_setenv ("G_FILENAME_ENCODING", "US-ASCII", TRUE); g_assert_false (g_get_filename_charsets (NULL)); +#endif res = g_filename_to_utf8 ("ab\0c", 4, &bytes_read, NULL, &error); @@ -878,8 +884,11 @@ test_filename_from_utf8_embedded_nul_utf8 (void) gsize bytes_read; GError *error = NULL; +#ifndef G_OS_WIN32 + /* G_FILENAME_ENCODING has no effect on Windows for g_get_filename_charsets() */ g_setenv ("G_FILENAME_ENCODING", "UTF-8", TRUE); g_assert_true (g_get_filename_charsets (NULL)); +#endif res = g_filename_from_utf8 ("ab\0c", 4, &bytes_read, NULL, &error); @@ -899,8 +908,11 @@ test_filename_from_utf8_embedded_nul_iconv (void) gsize bytes_read; GError *error = NULL; +#ifndef G_OS_WIN32 + /* G_FILENAME_ENCODING has no effect on Windows for g_get_filename_charsets() */ g_setenv ("G_FILENAME_ENCODING", "US-ASCII", TRUE); g_assert_false (g_get_filename_charsets (NULL)); +#endif res = g_filename_from_utf8 ("ab\0c", 4, &bytes_read, NULL, &error);