Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

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

 



On Wed, Sep 04, 2013 at 10:38:03AM -0700, Junio C Hamano wrote:

> >> This is way off tangent, but I am somewhat sympathetic to Felipe's
> >> "compare actual with expect", with reservations.
> >
> > This isn't an argument either way, but note that JUnit (and NUnit and
> > PHPUnit) all have assertEquals methods that take the arguments in the
> > order "expect, actual".  I've always assumed that Git's test framework
> > was imitating that,...
> 
> No.  See 82ebb0b6 (add test_cmp function for test scripts,
> 2008-03-12).  The "test_cmp" was a replacement for "diff -u", and
> the same order we fed "diff -u", i.e. expect then actual, was
> carried over.

I don't think it was intentional at the time. But over the intervening 5
years, I have noticed that I certainly think of "test_cmp A B" as
"differences from A to B", and the order makes sense. IOW, the "test_cmp
is diff" abstraction is leaky, and that is fine (if it were not leaky,
then order would not matter at all, but it clearly does).

But let's take a step back. This seems like an endian-ness issue to me.
I.e., some people prefer one order for test assertions, and other people
prefer the other. Is anyone actually right, or is this simply a matter
of preference? And if it is simply a matter of preference, then why
bother going through the pain of changing the current project standard?

Though I prefer the current, I can certainly live and adapt to a changed
standard, and I do not mind doing so if there is a good reason. But I've
yet to see any argument beyond "it is not what I like". Which to me
argues for the status quo as the path of least resistance.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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]