summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTing-Wei Lan <lantw@src.gnome.org>2019-07-05 15:07:27 +0800
committerTing-Wei Lan <lantw@src.gnome.org>2019-07-05 15:13:11 +0800
commit7089f67f14760ff23d4c298c4dc0b5666da8f62e (patch)
tree283e79e7420ee73db952f93afdbfd230c87125bf
parenta656555f76f1b5666d1210e4a6a02b1f3d619aec (diff)
downloadglib-7089f67f14760ff23d4c298c4dc0b5666da8f62e.tar.gz
gdatetime: Unset LC_ALL for the test as well
This is a follow-up to a0c7f85437093b073b3e3b2c9cb337065b6ea896. In addition LC_MESSAGES, we should remove LC_ALL from the environment as well. Otherwise, LC_ALL overrides LC_MESSAGES, causing the test to fail on FreeBSD when LC_ALL is set to a non-English locale.
-rw-r--r--glib/tests/gdatetime.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c
index 00e22181e..6d89ea47a 100644
--- a/glib/tests/gdatetime.c
+++ b/glib/tests/gdatetime.c
@@ -1327,6 +1327,7 @@ test_GDateTime_printf (void)
* that long, and it will cause the test to fail if dst isn't big
* enough.
*/
+ gchar *old_lc_all;
gchar *old_lc_messages;
gchar dst[64];
struct tm tt;
@@ -1357,6 +1358,9 @@ GDateTime *__dt = g_date_time_new_local (2009, 10, 24, 0, 0, 0);\
g_date_time_unref (dt); \
g_free (p); } G_STMT_END
+ old_lc_all = g_strdup (g_getenv ("LC_ALL"));
+ g_unsetenv ("LC_ALL");
+
old_lc_messages = g_strdup (g_getenv ("LC_MESSAGES"));
g_setenv ("LC_MESSAGES", "C", TRUE);
@@ -1434,6 +1438,10 @@ GDateTime *__dt = g_date_time_new_local (2009, 10, 24, 0, 0, 0);\
else
g_unsetenv ("LC_MESSAGES");
g_free (old_lc_messages);
+
+ if (old_lc_all != NULL)
+ g_setenv ("LC_ALL", old_lc_all, TRUE);
+ g_free (old_lc_all);
}
static void