summaryrefslogtreecommitdiff
path: root/libc/stdio-common/tst-sprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdio-common/tst-sprintf.c')
-rw-r--r--libc/stdio-common/tst-sprintf.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libc/stdio-common/tst-sprintf.c b/libc/stdio-common/tst-sprintf.c
index bfa79c9cc..42159a26f 100644
--- a/libc/stdio-common/tst-sprintf.c
+++ b/libc/stdio-common/tst-sprintf.c
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
+#include <locale.h>
#include <string.h>
#include <gnu/option-groups.h>
@@ -61,5 +62,17 @@ main (void)
result = 1;
}
+ if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
+ {
+ puts ("cannot set locale");
+ result = 1;
+ }
+ else if (sprintf (buf, "%.8s\n", "Foo: \277") != 7
+ || strcmp (buf, "Foo: \277\n") != 0)
+ {
+ printf ("sprintf (buf, \"%%.8s\\n\", \"Foo: \\277\") produced '%s' output\n", buf);
+ result = 1;
+ }
+
return result;
}