X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fnoerr%2Ftest%2Frun.c;h=31fb67400572d43aca0abf7b36f003ecf225346f;hb=61f58ff94e35c9b8ac5488554e2554bc5c9888b3;hp=6f1361ce4d851929196c5c404de17bee91e2354a;hpb=b2def1c863e7e936eca2ee5d0fb1ccd7c83e4be7;p=ccan diff --git a/ccan/noerr/test/run.c b/ccan/noerr/test/run.c index 6f1361ce..31fb6740 100644 --- a/ccan/noerr/test/run.c +++ b/ccan/noerr/test/run.c @@ -1,20 +1,19 @@ -#include "noerr/noerr.h" -#include "tap/tap.h" -#include "noerr/noerr.c" +#include +#include +#include #include #include #include #include #include -int main(int argc, char *argv[]) +int main(void) { - /* tempnam(3) is generally a bad idea, but OK here. */ - char *name = tempnam(NULL, "noerr"); + const char *name = "noerr.file"; int fd; FILE *fp; - plan_tests(15); + plan_tests(16); /* Should fail to unlink. */ ok1(unlink(name) != 0); ok1(errno == ENOENT); @@ -58,6 +57,11 @@ int main(int argc, char *argv[]) errno = 100; ok1(fclose_noerr(fp) == 0); ok1(errno == 100); + unlink(name); + + errno = 101; + free_noerr(malloc(7)); + ok1(errno == 101); return exit_status(); }