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

Re: [PATCH 8/8] t0012: test "-h" with builtins

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jun 13, 2017, 23:08 UTC
Message-ID
<20170613230803.GP133952@aiede.mtv.corp.google.com>
In-Reply-To
<20170530051930.pqywvihwl5klg7hz@sigill.intra.peff.net>
Hi,
Jeff King wrote:
Show 17 quoted lines
> --- a/t/t0012-help.sh
> +++ b/t/t0012-help.sh
> @@ -49,4 +49,16 @@ test_expect_success "--help does not work for guides" "
>  	test_i18ncmp expect actual
>  "
> 
> +test_expect_success 'generate builtin list' '
> +	git --list-builtins >builtins
> +'
> +
> +while read builtin
> +do
> +	test_expect_success "$builtin can handle -h" '
> +		test_expect_code 129 git $builtin -h >output 2>&1 &&
> +		test_i18ngrep usage output
> +	'
> +done <builtins
I love this.  A few thoughts:
- I think the "generate builtin list" test should be marked as setup
  so people know it can't be skipped.  I'll send a followup to do that.
- By the same token, if "generate builtin list" fails then these
  commands afterward would fail in an unpleasant way.  Fortunately
  that's straightforward to fix, too.
- This checks both stdout and stderr to verify that the usage appears
  somewhere.  I would have expected commands to be consistent ---
  should they always send usage to stdout, since the user requested it,
  or to stderr, since that's what we have done historically?
  So I understand why this test is agnostic about that but I suspect
  it's pointing to some inconsistency that could be fixed independently.
- Do we plan to translate the "usage:" prefix some day?  I could go
  both ways --- on one hand, having a predictable error:/usage:/fatal:
  prefix may make life easier for e.g. GUI authors trying to show
  different kinds of error messages in different ways, but on the other
  hand, always using English for the prefix may be unfriendly to non
  English speakers.
  In the past I had assumed it would never be translated but now I'm
  not so sure.  What do you think?
- Should we have something like this for non-builtins, too?
In any case,
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Previous: Jeff KingNext: Jeff King
Message 36 of 38 in “[Bug] setup_git_env called without repository”
  1. Zero KingMay 29, 2017
  2. Ævar Arnfjörð BjarmasonMay 29, 2017
  3. Jeff KingMay 29, 2017
  4. 0/8 consistent "-h" handling in builtinsJeff King, May 30, 2017
  5. 1/8 am: handle "-h" argument earlierJeff King, May 30, 2017
  6. Junio C HamanoMay 30, 2017
  7. 2/8 credential: handle invalid arguments earlierJeff King, May 30, 2017
  8. 3/8 upload-archive: handle "-h" option earlyJeff King, May 30, 2017
  9. 4/8 remote-{ext,fd}: print usage message on invalid argumentsJeff King, May 30, 2017
  10. 5/8 submodule--helper: show usage for "-h"Jeff King, May 30, 2017
  11. 6/8 version: convert to parse-optionsJeff King, May 30, 2017
  12. version: move --build-options to a test helperÆvar Arnfjörð Bjarmason, May 30, 2017
  13. Jeff KingMay 30, 2017
  14. Johannes SchindelinMay 31, 2017
  15. Jeff KingMay 31, 2017
  16. Johannes SchindelinMay 31, 2017
  17. Ævar Arnfjörð BjarmasonMay 31, 2017
  18. Jeff KingMay 31, 2017
  19. 7/8 git: add hidden --list-builtins optionJeff King, May 30, 2017
  20. 8/8 t0012: test "-h" with builtinsJeff King, May 30, 2017
  21. Junio C HamanoMay 30, 2017
  22. Jeff KingMay 30, 2017
  23. Junio C HamanoMay 30, 2017
  24. Jeff KingMay 30, 2017
  25. Junio C HamanoMay 30, 2017
  26. Jeff KingMay 30, 2017
  27. Jeff KingMay 30, 2017
  28. Junio C HamanoMay 30, 2017
  29. Junio C HamanoJun 1, 2017
  30. Jeff KingJun 1, 2017
  31. Junio C HamanoJun 1, 2017
  32. Junio C HamanoJun 1, 2017
  33. Jeff KingJun 1, 2017
  34. Junio C HamanoJun 1, 2017
  35. Jeff KingJun 1, 2017
  36. Jonathan NiederJun 13, 2017
  37. Jeff KingJun 14, 2017
  38. Junio C HamanoMay 30, 2017

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.