X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftal%2Fstr%2Ftest%2Frun-fmt-terminate.c;fp=ccan%2Ftal%2Fstr%2Ftest%2Frun-fmt-terminate.c;h=9dfd00155a536873da4a1c7b4ea93f6b67070309;hb=64e9e7145aac9502655c5799ab711b9766c1da57;hp=0000000000000000000000000000000000000000;hpb=97a1ba3d6fac93e680e3d95cef930dea4fdd0822;p=ccan diff --git a/ccan/tal/str/test/run-fmt-terminate.c b/ccan/tal/str/test/run-fmt-terminate.c new file mode 100644 index 00000000..9dfd0015 --- /dev/null +++ b/ccan/tal/str/test/run-fmt-terminate.c @@ -0,0 +1,22 @@ +#include +#include +#include +#include +#include +#include "helper.h" + +/* Empty format string: should still terminate! */ +int main(int argc, char *argv[]) +{ + char *str; + const char *fmt = ""; + + plan_tests(1); + /* GCC complains about empty format string, complains about non-literal + * with no args... */ + str = tal_fmt(NULL, fmt, ""); + ok1(!strcmp(str, "")); + tal_free(str); + + return exit_status(); +}