[glib: 2/3] tests: Unset CHARSET when testing locales to avoid it breaking tests




commit 3fecaa3924ac3b8180c817810a98f59fa166f386
Author: Philip Withnall <pwithnall endlessos org>
Date:   Fri Nov 26 12:08:02 2021 +0000

    tests: Unset CHARSET when testing locales to avoid it breaking tests
    
    The charset set in `CHARSET` overrides the charset after the `.` in any
    `LC_*` category (set via the environment or `setlocale()`). This will
    break many tests, but in particular it definitely breaks the
    `/GDateTime/format_mixed/` tests which are specifically checking
    different charsets being set for different `LC_*` categories.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Fixes: #2514

 glib/tests/gdatetime.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c
index fd2477479..008aa3ce4 100644
--- a/glib/tests/gdatetime.c
+++ b/glib/tests/gdatetime.c
@@ -3047,6 +3047,10 @@ main (gint   argc,
    * Unset it to avoid interference with tests using setlocale and translation. */
   g_unsetenv ("LANGUAGE");
 
+  /* GLib uses CHARSET to allow overriding the character set used for all locale
+   * categories. Unset it to avoid interference with tests. */
+  g_unsetenv ("CHARSET");
+
   g_test_init (&argc, &argv, NULL);
 
   /* GDateTime Tests */


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