Re: [PATCHv5 9/9] t3301: Modernize
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Nov 12, 2014, 01:57 UTC
- Message-ID
- <CAPig+cSVtAi-n4EKaOgNwDqLvajzvozRG5_o3XjfZAMzW8T8-g@mail.gmail.com>
- In-Reply-To
- <1415752816-22782-10-git-send-email-johan@herland.net>
On Tue, Nov 11, 2014 at 7:40 PM, Johan Herland <johan@herland.net> wrote:
Show 19 quoted lines
> Make this test script appear somewhat less old-fashioned: > Signed-off-by: Johan Herland <johan@herland.net> > --- > diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh > index 416ed9e..861c159 100755 > --- a/t/t3301-notes.sh > +++ b/t/t3301-notes.sh > @@ -50,206 +44,186 @@ test_expect_success 'handle empty notes gracefully' ' > ' > > test_expect_success 'create notes' ' > - git config core.notesRef refs/notes/commits && > MSG=b4 git notes add && > - test ! -f .git/NOTES_EDITMSG && > - test 1 = $(git ls-tree refs/notes/commits | wc -l) && > - test b4 = $(git notes show) && > + test_path_is_missing .git/NOTES_EDITMSG && > + git ls-tree -r refs/notes/commits >actual && > + test_line_count = 1 actual
Broken &&-chain. This problem is repeated each place use invoke test_line_count().
Show 95 quoted lines
> + test "b4" = "$(git notes show)" &&
> git show HEAD^ &&
> test_must_fail git notes show HEAD^
> '
>
> test_expect_success 'show notes entry with %N' '
> - for l in A b4 B
> - do
> - echo "$l"
> - done >expect &&
> - git show -s --format='A%n%NB' >output &&
> - test_cmp expect output
> + test_write_lines A b4 B >expect &&
> + git show -s --format="A%n%NB" >actual &&
> + test_cmp expect actual
> '
>
> -cat >expect <<EOF
> -d423f8c refs/notes/commits@{0}: notes: Notes added by 'git notes add'
> -EOF
> -
> test_expect_success 'create reflog entry' '
> - git reflog show refs/notes/commits >output &&
> - test_cmp expect output
> + cat <<-EOF >expect &&
> + a1d8fa6 refs/notes/commits@{0}: notes: Notes added by '"'"'git notes add'"'"'
> + EOF
> + git reflog show refs/notes/commits >actual &&
> + test_cmp expect actual
> '
>
> test_expect_success 'edit existing notes' '
> MSG=b3 git notes edit &&
> - test ! -f .git/NOTES_EDITMSG &&
> - test 1 = $(git ls-tree refs/notes/commits | wc -l) &&
> - test b3 = $(git notes show) &&
> + test_path_is_missing .git/NOTES_EDITMSG &&
> + git ls-tree -r refs/notes/commits >actual &&
> + test_line_count = 1 actual
> + test "b3" = "$(git notes show)" &&
> git show HEAD^ &&
> test_must_fail git notes show HEAD^
> '
>
> test_expect_success 'cannot "git notes add -m" where notes already exists' '
> test_must_fail git notes add -m "b2" &&
> - test ! -f .git/NOTES_EDITMSG &&
> - test 1 = $(git ls-tree refs/notes/commits | wc -l) &&
> - test b3 = $(git notes show) &&
> + test_path_is_missing .git/NOTES_EDITMSG &&
> + git ls-tree -r refs/notes/commits >actual &&
> + test_line_count = 1 actual
> + test "b3" = "$(git notes show)" &&
> git show HEAD^ &&
> test_must_fail git notes show HEAD^
> '
>
> test_expect_success 'can overwrite existing note with "git notes add -f -m"' '
> git notes add -f -m "b1" &&
> - test ! -f .git/NOTES_EDITMSG &&
> - test 1 = $(git ls-tree refs/notes/commits | wc -l) &&
> - test b1 = $(git notes show) &&
> + test_path_is_missing .git/NOTES_EDITMSG &&
> + git ls-tree -r refs/notes/commits >actual &&
> + test_line_count = 1 actual
> + test "b1" = "$(git notes show)" &&
> git show HEAD^ &&
> test_must_fail git notes show HEAD^
> '
>
> test_expect_success 'add w/no options on existing note morphs into edit' '
> MSG=b2 git notes add &&
> - test ! -f .git/NOTES_EDITMSG &&
> - test 1 = $(git ls-tree refs/notes/commits | wc -l) &&
> - test b2 = $(git notes show) &&
> + test_path_is_missing .git/NOTES_EDITMSG &&
> + git ls-tree -r refs/notes/commits >actual &&
> + test_line_count = 1 actual
> + test "b2" = "$(git notes show)" &&
> git show HEAD^ &&
> test_must_fail git notes show HEAD^
> '
>
> test_expect_success 'can overwrite existing note with "git notes add -f"' '
> MSG=b1 git notes add -f &&
> - test ! -f .git/NOTES_EDITMSG &&
> - test 1 = $(git ls-tree refs/notes/commits | wc -l) &&
> - test b1 = $(git notes show) &&
> + test_path_is_missing .git/NOTES_EDITMSG &&
> + git ls-tree -r refs/notes/commits >actual &&
> + test_line_count = 1 actual
> + test "b1" = "$(git notes show)" &&
> git show HEAD^ &&
> test_must_fail git notes show HEAD^
> '