git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t6024-recursive-merge.sh: hide spurious output when not running verbosely

From
Jeff King <peff@peff.net>
Date
Feb 29, 2008, 23:01 UTC
Message-ID
<20080229230156.GA8742@coredump.intra.peff.net>
In-Reply-To
<20080229225816.GA24892@glandium.org>
On Fri, Feb 29, 2008 at 11:58:16PM +0100, Mike Hommey wrote:
Show 11 quoted lines
> > > -git reset --hard
> > > +git reset --hard >&3 2>&4
> > >  test_expect_success 'refuse to merge binary files' '
> > >  	printf "\0" > binary-file &&
> > >  	git add binary-file &&
> > 
> > Should this perhaps just be:
> > 
> >   test_expect_success 'reset state' 'git reset --hard'
> 
> Is it really about testing git reset ?

No, of course not. Nor is t0003 about testing 'setup'. But it is a convention[1] in git tests to do everything inside a test_expect_success wrapper, which is beneficial because:

  - you get your output handled properly automagically :)
  - if the setup step fails, we notice. Which means:
     - it cannot silently cause a later test to succeed (e.g., setup
       changes a file, then the real test reverts it)
     - it is easier to debug failing tests, because you are notified
       of the _first_ failure
-Peff

[1] By convention, I don't necessarily mean that there is a written rule, nor that we always do it that way, but only that in my experience we usually do. Somebody like Junio could say more definitely what is preferred.

Previous: Mike HommeyNext: Junio C Hamano
Message 4 of 12 in “t6024-recursive-merge.sh: hide spurious output when not running verbosely”
  1. t6024-recursive-merge.sh: hide spurious output when not running verboselyMike Hommey, Feb 29, 2008
  2. Jeff KingFeb 29, 2008
  3. Mike HommeyFeb 29, 2008
  4. Jeff KingFeb 29, 2008
  5. Junio C HamanoFeb 29, 2008
  6. Jeff KingFeb 29, 2008
  7. Johannes SchindelinFeb 29, 2008
  8. Junio C HamanoFeb 29, 2008
  9. Jeff KingMar 1, 2008
  10. Shawn O. PearceMar 1, 2008
  11. Jeff KingMar 1, 2008
  12. Junio C HamanoMar 1, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.