X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-vasnprintf-posix.c;h=3a9879f77c6a6ec5427f13896066e49e156a1baf;hb=e95ae6d7e8f2627cf450649daf30071f1971f404;hp=74ba1653570da5c1b2c9de0a6d7e527bb33c182a;hpb=b2e2010c7c902235b5efb5bd3c6529f61b093aa4;p=gnulib.git diff --git a/tests/test-vasnprintf-posix.c b/tests/test-vasnprintf-posix.c index 74ba16535..3a9879f77 100644 --- a/tests/test-vasnprintf-posix.c +++ b/tests/test-vasnprintf-posix.c @@ -20,6 +20,7 @@ #include "vasnprintf.h" +#include #include #include #include @@ -3636,6 +3637,46 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) } } #endif + +#if HAVE_WCHAR_T + /* Test that converting an invalid wchar_t[] to char[] fails with EILSEQ. */ + { + static const wchar_t input[] = { (wchar_t) 1702057263, 114, 0 }; + size_t length; + char *result = my_asnprintf (NULL, &length, "%ls %d", input, 99); + if (result == NULL) + ASSERT (errno == EILSEQ); + else + free (result); + } + { + static const wchar_t input[] = { (wchar_t) 1702057263, 114, 0 }; + size_t length; + char *result = my_asnprintf (NULL, &length, "%3ls %d", input, 99); + if (result == NULL) + ASSERT (errno == EILSEQ); + else + free (result); + } + { + static const wchar_t input[] = { (wchar_t) 1702057263, 114, 0 }; + size_t length; + char *result = my_asnprintf (NULL, &length, "%.1ls %d", input, 99); + if (result == NULL) + ASSERT (errno == EILSEQ); + else + free (result); + } + { + static const wchar_t input[] = { (wchar_t) 1702057263, 114, 0 }; + size_t length; + char *result = my_asnprintf (NULL, &length, "%3.1ls %d", input, 99); + if (result == NULL) + ASSERT (errno == EILSEQ); + else + free (result); + } +#endif } static char *