diff options
Diffstat (limited to 'test/locale/tst-setlocale.c')
-rw-r--r-- | test/locale/tst-setlocale.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/locale/tst-setlocale.c b/test/locale/tst-setlocale.c new file mode 100644 index 000000000..1f8e68d88 --- /dev/null +++ b/test/locale/tst-setlocale.c @@ -0,0 +1,25 @@ +/* Test case by Jakub Jelinek <jakub@redhat.com>. */ +#include <locale.h> +#include <stdio.h> +#include <string.h> + +int +main (void) +{ + char q[30]; + char *s; + + setlocale (LC_ALL, ""); + printf ("after setlocale (LC_ALL, \"\"): %s\n", setlocale(LC_NUMERIC, NULL)); + + strcpy (q, "de_DE.UTF-8"); + setlocale (LC_NUMERIC, q); + printf ("after setlocale (LC_NUMERIC, \"%s\"): %s\n", + q, setlocale(LC_NUMERIC, NULL)); + + strcpy (q, "de_DE.ISO-8859-1"); + s = setlocale (LC_NUMERIC, NULL); + printf ("after overwriting string: %s\n", s); + + return strcmp (s, "de_DE.UTF-8") != 0; +} |