[glib/fix-convert-tests-windows] glib/tests/convert.c: Skip tests that aren't meaningful for Windows



commit 6e224f7677e80a53aa43c92e10659fb700e0154a
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Feb 5 22:18:40 2019 +0800

    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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]