Re: [PATCH 08/16] t5304: use helper to report failure of test foo = bar

2014-10-08 Thread Jeff King
On Wed, Oct 08, 2014 at 12:17:07AM +0200, Michael Haggerty wrote: On 10/07/2014 11:53 PM, Junio C Hamano wrote: Hmph, your 'test' in that name is a generic verb we check that..., which I think aligns better with the other test_foo functions. When I suggested 'test_verbose', 'test' in that

Re: [PATCH 08/16] t5304: use helper to report failure of test foo = bar

2014-10-08 Thread Junio C Hamano
Jeff King p...@peff.net writes: On Wed, Oct 08, 2014 at 12:17:07AM +0200, Michael Haggerty wrote: On 10/07/2014 11:53 PM, Junio C Hamano wrote: Hmph, your 'test' in that name is a generic verb we check that..., which I think aligns better with the other test_foo functions. When I

Re: [PATCH 08/16] t5304: use helper to report failure of test foo = bar

2014-10-07 Thread Michael Haggerty
On 10/03/2014 10:27 PM, Jeff King wrote: For small outputs, we sometimes use: test $(some_cmd) = something we expect instead of a full test_cmp. The downside of this is that when it fails, there is no output at all from the script. Let's introduce a small helper to make tests easier to

Re: [PATCH 08/16] t5304: use helper to report failure of test foo = bar

2014-10-07 Thread Junio C Hamano
Michael Haggerty mhag...@alum.mit.edu writes: I don't like the three-argument version of test_eq. Wouldn't using a comparison operator other than = would be very confusing, given that eq is in the name of the function? It also doesn't look like you use this feature. An alternative direction

Re: [PATCH 08/16] t5304: use helper to report failure of test foo = bar

2014-10-07 Thread Jeff King
On Tue, Oct 07, 2014 at 10:29:59AM -0700, Junio C Hamano wrote: test_eq () { if test $1 != $2 then printf %s $1 expect printf %s $2 actual test_cmp expect actual fi } [...] The above superficially looks nice; ! test_eq a b

Re: [PATCH 08/16] t5304: use helper to report failure of test foo = bar

2014-10-07 Thread Junio C Hamano
Jeff King p...@peff.net writes: On Tue, Oct 07, 2014 at 10:29:59AM -0700, Junio C Hamano wrote: ... The function is similar to test_cmp which takes two files but takes two strings, so test_cmp_str or something perhaps (we already have test_cmp_rev to compare two revisions, and the suggested

Re: [PATCH 08/16] t5304: use helper to report failure of test foo = bar

2014-10-07 Thread Junio C Hamano
Jeff King p...@peff.net writes: Based on your responses, I'm leaning towards: test_cmp_str() { test $@ return 0 echo 2 command failed: test $* return 1 } since the point is really just to print _something_ when the test fails (any quoting or whitespace may be

Re: [PATCH 08/16] t5304: use helper to report failure of test foo = bar

2014-10-07 Thread Jeff King
On Tue, Oct 07, 2014 at 01:35:15PM -0700, Junio C Hamano wrote: Yeah, if we are going to reduce it down to the above implementation, intereseting things like test -f $frotz will become possible and cmp-str stops making sense. It really is about We run test and expect it to yield true.

Re: [PATCH 08/16] t5304: use helper to report failure of test foo = bar

2014-10-07 Thread Junio C Hamano
Jeff King p...@peff.net writes: On Tue, Oct 07, 2014 at 01:35:15PM -0700, Junio C Hamano wrote: Yeah, if we are going to reduce it down to the above implementation, intereseting things like test -f $frotz will become possible and cmp-str stops making sense. It really is about We run test

Re: [PATCH 08/16] t5304: use helper to report failure of test foo = bar

2014-10-07 Thread Michael Haggerty
On 10/07/2014 11:53 PM, Junio C Hamano wrote: Jeff King p...@peff.net writes: On Tue, Oct 07, 2014 at 01:35:15PM -0700, Junio C Hamano wrote: Yeah, if we are going to reduce it down to the above implementation, intereseting things like test -f $frotz will become possible and cmp-str stops

[PATCH 08/16] t5304: use helper to report failure of test foo = bar

2014-10-03 Thread Jeff King
For small outputs, we sometimes use: test $(some_cmd) = something we expect instead of a full test_cmp. The downside of this is that when it fails, there is no output at all from the script. Let's introduce a small helper to make tests easier to debug. Signed-off-by: Jeff King p...@peff.net

Re: [PATCH 08/16] t5304: use helper to report failure of test foo = bar

2014-10-03 Thread Junio C Hamano
Jeff King p...@peff.net writes: For small outputs, we sometimes use: test $(some_cmd) = something we expect instead of a full test_cmp. The downside of this is that when it fails, there is no output at all from the script. Let's introduce a small helper to make tests easier to debug.

Re: [PATCH 08/16] t5304: use helper to report failure of test foo = bar

2014-10-03 Thread Jeff King
On Fri, Oct 03, 2014 at 03:17:18PM -0700, Junio C Hamano wrote: That's a bit verbose. We could hide it behind something like test_eq, too, but it introduces several extra new processes. What do you mean by extra new processes? Whether open coded in a verbose way, or wrapped inside a