12 size_t inlen
= strlen(inbuf
);
15 char *bad
= "bad-codeset";
17 cd
= iconv_open(bad
, bad
);
18 if (cd
!= (iconv_t
)-1)
19 t_error("iconv_open(\"%s\",\"%s\") didn't fail\n", bad
, bad
);
21 t_error("iconv_open(\"%s\",\"%s\") did not fail with EINVAL, got %s\n", bad
, bad
, strerror(errno
));
24 cd
= iconv_open("UTF-8", "UTF-8");
25 if (cd
== (iconv_t
)-1)
26 t_error("iconv_open(\"\",\"\") failed: %s\n", strerror(errno
));
30 r
= iconv(cd
, &inbuf
, &inlen
, &outbuf
, &outlen
);
32 t_error("iconv() did not fail with 0 output length\n");
34 t_error("iconv() did not fail with E2BIG, got %s\n", strerror(errno
));
38 r
= iconv(cd
, &inbuf
, &inlen
, &outbuf
, &outlen
);
40 t_error("iconv() did not return 0 when converting utf8 to utf8, got %d\n", r
);
42 t_error("iconv() failed: %s\n", strerror(errno
));
46 t_error("iconv_close failed: %s\n", strerror(errno
));