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

Re: [PATCH 6/7] t1303 (config): style tweaks

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 7, 2010, 04:52 UTC
Message-ID
<7vtym2p34e.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20100907043050.GA13291@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 22 quoted lines
> ... But I really don't want to be too draconian
> about "everything must go into test_expect_success". Sure, if you are
> executing commands that might have output, or might be of interest to
> the user, put them there. But I find this a lot more readable:
>
> cat >expect <<'EOF'
> ... some expected output ...
> EOF
> test_expect_success 'frob it' '
>         git frob &&
>         test_cmp expect actual
> '
>
> than:
>
> test_expect_success 'frob it' '
>         cat >expect <<"EOF" &&
> ... some expected output ...
> EOF
>         git frob &&
>         test_cmp expect actual
> '
I agree.

My gut feeling has been that any set-up that uses "git" should never be outside test_expect_success, but things like cat <<HERE / echo to prepare test vector are not expected to fail (we are not in the business of testing the build platform) and can be at the top of the script between the inclusion of test-lib.sh and the first test_expect_success.

When you throw in tools that are platform dependent to the mix, however, things get muddier. Setup that use stuff like "ln -s this that" and "setacl" is easier to handle inside test_expect_success guarded by an appropriate prerequisite. So even that "anything git should be inside, everything else can go outside if it wants to" rule of thumb is not so black and white.

Previous: Jeff KingNext: Jonathan Nieder
Message 15 of 27 in “Several tests: cd inside subshell instead of around”
  1. Several tests: cd inside subshell instead of aroundJens Lehmann, Sep 6, 2010
  2. Jonathan NiederSep 6, 2010
  3. Jens LehmannSep 6, 2010
  4. 0/7 Re: [PATCH] Several tests: cd inside subshell instead of aroundJonathan Nieder, Sep 7, 2010
  5. 1/7 tests: subshell indentation stylefixJonathan Nieder, Sep 7, 2010
  6. Jonathan NiederSep 7, 2010
  7. 2/7 t1450 (fsck): remove dangling objectsJonathan Nieder, Sep 7, 2010
  8. 3/7 t2105 (gitfile): add missing &&Jonathan Nieder, Sep 7, 2010
  9. Brad KingSep 7, 2010
  10. 4/7 t0004 (unwritable files): simplify error handlingJonathan Nieder, Sep 7, 2010
  11. 5/7 t1302 (core.repositoryversion): style tweaksJonathan Nieder, Sep 7, 2010
  12. Nguyen Thai Ngoc DuySep 7, 2010
  13. 6/7 t1303 (config): style tweaksJonathan Nieder, Sep 7, 2010
  14. Jeff KingSep 7, 2010
  15. Junio C HamanoSep 7, 2010
  16. Jonathan NiederSep 7, 2010
  17. guarding everything with test_expect_success (Re: [PATCH 6/7] t1303 (config): style tweaks)Jonathan Nieder, Sep 7, 2010
  18. Jeff KingSep 7, 2010
  19. Jonathan NiederSep 7, 2010
  20. 7/7 t2016 (checkout -p): use printf for multiline y/n inputJonathan Nieder, Sep 7, 2010
  21. Thomas RastSep 7, 2010
  22. Jonathan NiederSep 7, 2010
  23. Junio C HamanoSep 6, 2010
  24. Jonathan NiederSep 7, 2010
  25. Junio C HamanoSep 7, 2010
  26. Jonathan NiederSep 7, 2010
  27. t1020: Get rid of 'cd "$HERE"' at the start of each testJens Lehmann, Sep 7, 2010

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.