Jeff King <p...@peff.net> writes:

> +cmp_one_of () {
> +     for candidate in "$@"; do

Style ;-)

> +             echo "$candidate" >expect &&
> +             test_cmp expect actual &&
> +             return 0
> +     done
> +     return 1
> +}

It actually may be easier to understand if you write a trivial case
statement at the sole calling site of this helper function, though.

In any case, would it really be essential to make sure that the
output shows a phony (or a seemingly real) datestamp for this test?

The primary thing you wanted to achieve by the "gmtime gave us NULL,
let's substitute it with an arbitrary value to avoid dereferencing
the NULL" change was *not* that we see that same arbitrary value
comes out of the system, but that we do not die by attempting to
reference the NULL, I think.  Not dying is the primary thing we want
to (and we already do) test, no?

> +# date is within 2^63-1, but enough to choke glibc's gmtime.
> +# We check that either the date broke gmtime (and we return the
> +# usual epoch value), or gmtime gave us some sensible value.
> +#
> +# The sensible values are determined experimentally. The first
> +# is from AIX.
> +test_expect_success 'absurdly far-in-future dates' '
>       commit=$(munge_author_date HEAD 999999999999999999) &&
> -     echo "Thu Jan 1 00:00:00 1970 +0000" >expect &&
>       git log -1 --format=%ad $commit >actual &&
> -     test_cmp expect actual
> +     cmp_one_of \
> +             "Thu Jan 1 00:00:00 1970 +0000" \
> +             "Thu Oct 24 18:46:39 162396404 -0700"
>  '
>  
>  test_done
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to