diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2010-11-24 20:51:46 +0100 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2010-11-24 20:52:26 +0100 |
commit | 86b4bf7d3194a06281f053be341031d9196874c2 (patch) | |
tree | 96bcfbeb69df23b5ad252c7c6165cfad76575fa5 /test | |
parent | 673f444013915fe2cfd30019b27bf3b8d1d34a4e (diff) |
wchar: bug #1471: fix cornercase in mbrtowc
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/.gitignore | 1 | ||||
-rw-r--r-- | test/locale-mbwc/Makefile.in | 4 | ||||
-rw-r--r-- | test/locale-mbwc/tst2_mbrtowc.c | 21 |
3 files changed, 24 insertions, 2 deletions
diff --git a/test/.gitignore b/test/.gitignore index a4af61dd2..ffef25838 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -96,6 +96,7 @@ locale-mbwc/tst_wctomb locale-mbwc/tst_wctrans locale-mbwc/tst_wctype locale-mbwc/tst_wcwidth +locale-mbwc/tst2_mbrtowc locale/show-ucs-data locale/tst-digits locale/tst-langinfo diff --git a/test/locale-mbwc/Makefile.in b/test/locale-mbwc/Makefile.in index 05c232a9b..7c0e9d529 100644 --- a/test/locale-mbwc/Makefile.in +++ b/test/locale-mbwc/Makefile.in @@ -15,8 +15,8 @@ TESTS := tst_iswalnum tst_iswalpha tst_iswcntrl \ tst_wcspbrk tst_wcsrtombs tst_wcsspn tst_wcsstr \ tst_wcstod tst_wcstok tst_wcstombs tst_wcswidth \ tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \ - tst_wctype tst_wcwidth tst_strfmon - + tst_wctype tst_wcwidth tst_strfmon \ + tst2_mbrtowc # NOTE: For now disabled tst_strfmon to avoid build failure. TESTS_DISABLED := tst_strfmon diff --git a/test/locale-mbwc/tst2_mbrtowc.c b/test/locale-mbwc/tst2_mbrtowc.c new file mode 100644 index 000000000..92e12838c --- /dev/null +++ b/test/locale-mbwc/tst2_mbrtowc.c @@ -0,0 +1,21 @@ +#include <wchar.h> +#include <assert.h> +#include <stdlib.h> + +/* bugs.uclibc.org/1471 : make sure output is 0 */ +static int +do_test(void) +{ + wchar_t output; + int result; + + output = L'A'; /* anything other than 0 will do... */ + result = mbrtowc (&output, "", 1, 0); + + assert (result == 0); + assert (output == 0); + + return EXIT_SUCCESS; +} +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" |