On Thu, Oct 26, 2017 at 11:02:13AM +0700, Robert Elz wrote:
>         errno = 0;
>         t = mktime(&tms);
>         ATF_REQUIRE_ERRNO(0, t != (time_t)-1);

I guess the author meant to write:

        errno = 0;
        t = mktime(&tms);
        ATF_REQUIRE(errno == 0;
        ATF_REQUIRE(t != (time_t)-1);

(not judging on the validity this test would have)

> I'd expect ATF_REQUIRE_ERRNO() to be used when testing for expected known
> failure, like if you were to do
> 
>       res = unlink("/tmp/no/such/file");
> 
> you'd expect res == -1, and errno == ENOENT, so you'd write
> 
>       ATF_REQUIRE_ERRNO(ENOENT, res == -1);

Exactly that is the intended use.

Martin

Reply via email to