diff options
author | James Booth <boothj5@gmail.com> | 2017-04-29 20:33:28 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2017-04-29 20:33:28 +0100 |
commit | d52355d72ccbebfa82fd5b1166f8d9265ec4ff6c (patch) | |
tree | 08e653b2cb3b69d2bb205177d39e1a29bf6242af /tests/unittests | |
parent | 3e18aab9f38fad3cd971ec09684f7e03f299cc87 (diff) | |
download | profani-tty-d52355d72ccbebfa82fd5b1166f8d9265ec4ff6c.tar.gz |
Set locale in unit tests
issue #901
Diffstat (limited to 'tests/unittests')
-rw-r--r-- | tests/unittests/unittests.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/unittests/unittests.c b/tests/unittests/unittests.c index 2938b9ff..41f99424 100644 --- a/tests/unittests/unittests.c +++ b/tests/unittests/unittests.c @@ -6,7 +6,9 @@ #include <setjmp.h> #include <cmocka.h> #include <sys/stat.h> +#include <stdlib.h> #include <locale.h> +#include <langinfo.h> #include "config.h" #include "xmpp/chat_session.h" @@ -38,7 +40,21 @@ #include "test_plugins_disco.h" int main(int argc, char* argv[]) { - setlocale(LC_ALL, ""); + setlocale(LC_ALL, "en_GB.UTF-8"); + char *codeset = nl_langinfo(CODESET); + char *lang = getenv("LANG"); + + printf("Charset information:\n"); + + if (lang) { + printf(" LANG: %s\n", lang); + } + if (codeset) { + printf(" CODESET: %s\n", codeset); + } + printf(" MB_CUR_MAX: %d\n", MB_CUR_MAX); + printf(" MB_LEN_MAX: %d\n", MB_LEN_MAX); + const UnitTest all_tests[] = { unit_test(replace_one_substr), |