Re: [PATCHv5 9/9] t3301: Modernize

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 11, 2014 at 7:40 PM, Johan Herland <johan@xxxxxxxxxxx> wrote:
> Make this test script appear somewhat less old-fashioned:
> Signed-off-by: Johan Herland <johan@xxxxxxxxxxx>
> ---
> 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().

> +       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^
>  '
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]