Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions
- From
Jeff King <peff@peff.net>
- Date
- Sep 8, 2013, 05:02 UTC
- Message-ID
- <20130908050227.GG14019@sigill.intra.peff.net>
- In-Reply-To
- <CAMP44s1uasvGmCMkMF2N0eTMgOdksG0HqeidXK+159HAi4jkpA@mail.gmail.com>
On Sat, Sep 07, 2013 at 11:52:10PM -0500, Felipe Contreras wrote:
Show 7 quoted lines
> > Ah, you mean "if you think that the compare function should behave like > > C *_cmp functions, it should be A-B". Perhaps it is simply that I do not > > think of the function in those terms, but more like "show me the > > differences from B to A". > > But that is the problem, you are unable to ignore the implementation. > You don't see test_cmp(), you see 'diff -u'.
Yes, I already said earlier in the thread:
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).
And I do not think it is a problem. The point of the function is not to abstract away the idea of comparison. The point is to give a hook for people on systems without "diff -u" to run the test suite.
Show 10 quoted lines
> > John mentioned JUnit, NUnit, and PHPUnit earlier in the thread. I > > believe that Ruby's Test::Unit::Assertions also has > > assert_equal(expected, actual). > > That's because they all do first expect, then actual. > > assert_equal( expected, actual, failure_message = nil ) > assert_not_equal( expected, actual, failure_message = nil ) > > That's why.
I do not see any reason why "not_equal" would not also work as "assert_not_equal(actual, expected)". Maybe I am missing your point.
-Peff