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
This commit is contained in:
Ting-Wei Lan 2015-04-29 14:51:14 +08:00
parent f9af40a133
commit 5574315b52
4 changed files with 4 additions and 3 deletions

View File

@ -379,7 +379,7 @@ main (int argc, char** argv)
3000, 3001, 3002, 3998, 3999, 4000, 4001, 4002, 4003 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, ""); setlocale (LC_ALL, "");
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
SetThreadLocale (MAKELCID (MAKELANGID (LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); SetThreadLocale (MAKELCID (MAKELANGID (LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT));

View File

@ -905,6 +905,7 @@ int
main (int argc, main (int argc,
char *argv[]) char *argv[])
{ {
g_setenv ("LC_ALL", "C", TRUE);
g_test_init (&argc, &argv, NULL); g_test_init (&argc, &argv, NULL);
g_test_add_func ("/fileutils/build-path", test_build_path); g_test_add_func ("/fileutils/build-path", test_build_path);

View File

@ -373,6 +373,7 @@ TestCase error_cases[] = /* error cases */
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
g_setenv ("LC_ALL", "C", TRUE);
g_test_init (&argc, &argv, NULL); g_test_init (&argc, &argv, NULL);
add_tests (test, "/glib/markup/subparser/success", test_cases); add_tests (test, "/glib/markup/subparser/success", test_cases);
add_tests (test, "/glib/markup/subparser/failure", error_cases); add_tests (test, "/glib/markup/subparser/failure", error_cases);

View File

@ -71,8 +71,6 @@ print_help (GOptionContext *options, gchar **argv)
gint argc = 3; gint argc = 3;
GError *error = NULL; GError *error = NULL;
g_setenv ("LANG", "C", TRUE);
g_option_context_parse (options, &argc, &argv, &error); g_option_context_parse (options, &argc, &argv, &error);
g_option_context_free (options); g_option_context_free (options);
exit(0); exit(0);
@ -2487,6 +2485,7 @@ main (int argc,
int i; int i;
gchar *test_name; gchar *test_name;
g_setenv ("LC_ALL", "C", TRUE);
g_test_init (&argc, &argv, NULL); g_test_init (&argc, &argv, NULL);
g_test_bug_base ("http://bugzilla.gnome.org/"); g_test_bug_base ("http://bugzilla.gnome.org/");