Re: [PATCH 1/3] t7005: use modern test style
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Aug 10, 2025, 19:42 UTC
- Message-ID
- <01674640-21f5-44f8-8208-d6b6d88b09c5@gmail.com>
- In-Reply-To
- <20250810160323.49372-2-ben.knoble+github@gmail.com>
Hi Ben
Thanks for cleaning up these tests
On 10/08/2025 17:03, D. Ben Knoble wrote:
Show 6 quoted lines
> > TERM=dumb > export TERM > test_expect_success 'dumb should error out when falling back on vi' ' > - > if git commit --amend
Instead of this "if" we should be using test_must_fail here
Show 16 quoted lines
> then > echo "Oops?" > @@ -56,13 +51,13 @@ > ' > > test_expect_success 'dumb should prefer EDITOR to VISUAL' ' > - > EDITOR=./e-EDITOR.sh && > VISUAL=./e-VISUAL.sh && > export EDITOR VISUAL && > git commit --amend && > - test "$(git show -s --format=%s)" = "Edited by EDITOR" > - > + echo "Edited by EDITOR" >expect && > + git show -s --format=%s >actual && > + test_cmp expect actual
This is a faithful conversion of the original but I'd be tempted to use test_commit_message instead as I think we really should be checking the whole message rather than just the subject line in all these tests.
test_commit_message HEAD -m "Edited by EDITOR"
The whitespace cleanups all look good to me
Thanks
Phillip
Show 49 quoted lines
> ' > > TERM=vt100 > @@ -83,8 +78,8 @@ > esac > test_expect_success "Using $i" ' > git --exec-path=. commit --amend && > - git show -s --pretty=oneline | > - sed -e "s/^[0-9a-f]* //" >actual && > + git show -s --pretty=oneline >show && > + <show sed -e "s/^[0-9a-f]* //" >actual && > test_cmp expect actual > ' > done > @@ -105,8 +100,8 @@ > esac > test_expect_success "Using $i (override)" ' > git --exec-path=. commit --amend && > - git show -s --pretty=oneline | > - sed -e "s/^[0-9a-f]* //" >actual && > + git show -s --pretty=oneline >show && > + <show sed -e "s/^[0-9a-f]* //" >actual && > test_cmp expect actual > ' > done > @@ -115,17 +110,18 @@ > echo "echo space >\"\$1\"" >"e space.sh" && > chmod a+x "e space.sh" && > GIT_EDITOR="./e\ space.sh" git commit --amend && > - test space = "$(git show -s --pretty=format:%s)" > - > + echo space >expect && > + git show -s --pretty=tformat:%s >actual && > + test_cmp expect actual > ' > > unset GIT_EDITOR > test_expect_success 'core.editor with a space' ' > - > git config core.editor \"./e\ space.sh\" && > git commit --amend && > - test space = "$(git show -s --pretty=format:%s)" > - > + echo space >expect && > + git show -s --pretty=tformat:%s >actual && > + test_cmp expect actual > ' > > test_done