From 5574315b5207e959d162553e3bb5681b6264fe27 Mon Sep 17 00:00:00 2001 From: Ting-Wei Lan Date: Wed, 29 Apr 2015 14:51:14 +0800 Subject: [PATCH] tests: Fix tests that fail with non-English locales Some tests check whether the translated messages are expected, so we have to force the use of English locales for them. https://bugzilla.gnome.org/show_bug.cgi?id=748610 --- glib/tests/date.c | 2 +- glib/tests/fileutils.c | 1 + glib/tests/markup-subparser.c | 1 + glib/tests/option-context.c | 3 +-- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/glib/tests/date.c b/glib/tests/date.c index 6239d510b..012e70713 100644 --- a/glib/tests/date.c +++ b/glib/tests/date.c @@ -379,7 +379,7 @@ main (int argc, char** argv) 3000, 3001, 3002, 3998, 3999, 4000, 4001, 4002, 4003 }; - g_setenv ("LANG", "en_US.utf-8", TRUE); + g_setenv ("LC_ALL", "en_US.utf-8", TRUE); setlocale (LC_ALL, ""); #ifdef G_OS_WIN32 SetThreadLocale (MAKELCID (MAKELANGID (LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); diff --git a/glib/tests/fileutils.c b/glib/tests/fileutils.c index 550c4d874..d218e78a0 100644 --- a/glib/tests/fileutils.c +++ b/glib/tests/fileutils.c @@ -905,6 +905,7 @@ int main (int argc, char *argv[]) { + g_setenv ("LC_ALL", "C", TRUE); g_test_init (&argc, &argv, NULL); g_test_add_func ("/fileutils/build-path", test_build_path); diff --git a/glib/tests/markup-subparser.c b/glib/tests/markup-subparser.c index 32188804d..13362664a 100644 --- a/glib/tests/markup-subparser.c +++ b/glib/tests/markup-subparser.c @@ -373,6 +373,7 @@ TestCase error_cases[] = /* error cases */ int main (int argc, char **argv) { + g_setenv ("LC_ALL", "C", TRUE); g_test_init (&argc, &argv, NULL); add_tests (test, "/glib/markup/subparser/success", test_cases); add_tests (test, "/glib/markup/subparser/failure", error_cases); diff --git a/glib/tests/option-context.c b/glib/tests/option-context.c index cad40a08a..12b86229f 100644 --- a/glib/tests/option-context.c +++ b/glib/tests/option-context.c @@ -71,8 +71,6 @@ print_help (GOptionContext *options, gchar **argv) gint argc = 3; GError *error = NULL; - g_setenv ("LANG", "C", TRUE); - g_option_context_parse (options, &argc, &argv, &error); g_option_context_free (options); exit(0); @@ -2487,6 +2485,7 @@ main (int argc, int i; gchar *test_name; + g_setenv ("LC_ALL", "C", TRUE); g_test_init (&argc, &argv, NULL); g_test_bug_base ("http://bugzilla.gnome.org/");