tests: Set locale in gtestutils tests to allow UTF-8 output

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2019-05-15 13:42:04 +01:00
parent dfa7a5b5b5
commit 81dbc7b07b
2 changed files with 6 additions and 1 deletions

View File

@ -17,6 +17,7 @@
*/
#include <glib.h>
#include <locale.h>
#ifdef G_OS_WIN32
#include <fcntl.h>
#include <io.h>
@ -52,6 +53,8 @@ main (int argc,
{
char *argv1;
setlocale (LC_ALL, "");
#ifdef G_OS_WIN32
/* Windows opens std streams in text mode, with \r\n EOLs.
* Sometimes it's easier to force a switch to binary mode than

View File

@ -29,7 +29,7 @@
#define G_LOG_DOMAIN "testing"
#include <glib.h>
#include <locale.h>
#include <stdlib.h>
#include <string.h>
@ -1215,6 +1215,8 @@ main (int argc,
{
argv0 = argv[0];
setlocale (LC_ALL, "");
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/random-generator/rand-1", test_rand1);