Re: [PATCH v2] tests: modernize the test script t0010-racy-git.sh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 29, 2024 at 6:36 PM Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes:
> > If taking it to this extent, then the modernized version of the last
> > couple lines would be:
> >
> >     git diff-files -p >out &&
> >     test_file_not_empty out
>
> Yes.  The modern style seems to prefer temporary files over
> variables; the reason probably is because it tends to be easier to
> remotely post-mortem?

Yes, that seems likely. Functions such as test_file_not_empty() also
provide an immediate indication of what went wrong without having to
spelunk the test detritus:

    'foo' is not a non-empty file. [*]

whereas `test "" != "$foo"` provides no output at all, so it's not
immediately clear which part of the test failed. Peff's `verbose`
function was intended to mitigate that problem by making the
expression verbose upon failure:

    verbose test "" != "$foo" &&

but never really caught on and was eventually retired by 8ddfce7144
(t: drop "verbose" helper function, 2023-05-08).

[*]: Admittedly, the double-negative in "'foo' is not a non-empty
file." is more than a little confusing. It probably would have been
better phrased as "'foo' should be empty but is not".





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux