Skip to content

Commit

Permalink
Merge branch 'avar/nuke-test_i18ngrep-again' into build-master
Browse files Browse the repository at this point in the history
* avar/nuke-test_i18ngrep-again:
  tests with git#17 test_i18ngrep: replace it with 'grep'
  tests with git#16 test_i18ngrep: replace it with 'grep'
  tests with git#15 test_i18ngrep: replace it with 'grep'
  tests with git#14 test_i18ngrep: replace it with 'grep'
  tests with git#13 test_i18ngrep: replace it with 'grep'
  tests with git#12 test_i18ngrep: replace it with 'grep'
  tests with git#11 test_i18ngrep: replace it with 'grep'
  • Loading branch information
avar committed Feb 7, 2023
2 parents 6e893b7 + 9351edd commit be905b3
Show file tree
Hide file tree
Showing 24 changed files with 327 additions and 327 deletions.
32 changes: 16 additions & 16 deletions t/t0028-working-tree-encoding.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,23 @@ do
# In these cases the BOM is prohibited.
cp bebom.utf${i}be.raw bebom.utf${i}be &&
test_must_fail git add bebom.utf${i}be 2>err.out &&
test_i18ngrep "fatal: BOM is prohibited .* utf-${i}be" err.out &&
test_i18ngrep "use UTF-${i} as working-tree-encoding" err.out &&
grep "fatal: BOM is prohibited .* utf-${i}be" err.out &&
grep "use UTF-${i} as working-tree-encoding" err.out &&
cp lebom.utf${i}le.raw lebom.utf${i}be &&
test_must_fail git add lebom.utf${i}be 2>err.out &&
test_i18ngrep "fatal: BOM is prohibited .* utf-${i}be" err.out &&
test_i18ngrep "use UTF-${i} as working-tree-encoding" err.out &&
grep "fatal: BOM is prohibited .* utf-${i}be" err.out &&
grep "use UTF-${i} as working-tree-encoding" err.out &&
cp bebom.utf${i}be.raw bebom.utf${i}le &&
test_must_fail git add bebom.utf${i}le 2>err.out &&
test_i18ngrep "fatal: BOM is prohibited .* utf-${i}LE" err.out &&
test_i18ngrep "use UTF-${i} as working-tree-encoding" err.out &&
grep "fatal: BOM is prohibited .* utf-${i}LE" err.out &&
grep "use UTF-${i} as working-tree-encoding" err.out &&
cp lebom.utf${i}le.raw lebom.utf${i}le &&
test_must_fail git add lebom.utf${i}le 2>err.out &&
test_i18ngrep "fatal: BOM is prohibited .* utf-${i}LE" err.out &&
test_i18ngrep "use UTF-${i} as working-tree-encoding" err.out
grep "fatal: BOM is prohibited .* utf-${i}LE" err.out &&
grep "use UTF-${i} as working-tree-encoding" err.out
'

test_expect_success "check required UTF-${i} BOM" '
Expand All @@ -118,13 +118,13 @@ do
cp nobom.utf${i}be.raw nobom.utf${i} &&
test_must_fail git add nobom.utf${i} 2>err.out &&
test_i18ngrep "fatal: BOM is required .* utf-${i}" err.out &&
test_i18ngrep "use UTF-${i}BE or UTF-${i}LE" err.out &&
grep "fatal: BOM is required .* utf-${i}" err.out &&
grep "use UTF-${i}BE or UTF-${i}LE" err.out &&
cp nobom.utf${i}le.raw nobom.utf${i} &&
test_must_fail git add nobom.utf${i} 2>err.out &&
test_i18ngrep "fatal: BOM is required .* utf-${i}" err.out &&
test_i18ngrep "use UTF-${i}BE or UTF-${i}LE" err.out
grep "fatal: BOM is required .* utf-${i}" err.out &&
grep "use UTF-${i}BE or UTF-${i}LE" err.out
'

test_expect_success "eol conversion for UTF-${i} encoded files on checkout" '
Expand Down Expand Up @@ -169,7 +169,7 @@ test_expect_success 'check unsupported encodings' '
echo "*.set text working-tree-encoding" >.gitattributes &&
printf "set" >t.set &&
test_must_fail git add t.set 2>err.out &&
test_i18ngrep "true/false are no valid working-tree-encodings" err.out &&
grep "true/false are no valid working-tree-encodings" err.out &&
echo "*.unset text -working-tree-encoding" >.gitattributes &&
printf "unset" >t.unset &&
Expand All @@ -182,7 +182,7 @@ test_expect_success 'check unsupported encodings' '
echo "*.garbage text working-tree-encoding=garbage" >.gitattributes &&
printf "garbage" >t.garbage &&
test_must_fail git add t.garbage 2>err.out &&
test_i18ngrep "failed to encode" err.out
grep "failed to encode" err.out
'

test_expect_success 'error if encoding round trip is not the same during refresh' '
Expand All @@ -201,7 +201,7 @@ test_expect_success 'error if encoding round trip is not the same during refresh
git update-ref refs/heads/main $COMMIT &&
test_must_fail git checkout HEAD^ 2>err.out &&
test_i18ngrep "error: .* overwritten by checkout:" err.out
grep "error: .* overwritten by checkout:" err.out
'

test_expect_success 'error if encoding garbage is already in Git' '
Expand All @@ -217,7 +217,7 @@ test_expect_success 'error if encoding garbage is already in Git' '
git update-ref refs/heads/main $COMMIT &&
git diff 2>err.out &&
test_i18ngrep "error: BOM is required" err.out
grep "error: BOM is required" err.out
'

test_lazy_prereq ICONV_SHIFT_JIS '
Expand Down
32 changes: 16 additions & 16 deletions t/t0041-usage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ test_expect_success 'tag --contains <existent_tag>' '
test_expect_success 'tag --contains <inexistent_tag>' '
test_must_fail git tag --contains "notag" >actual 2>actual.err &&
test_line_count = 0 actual &&
test_i18ngrep "error" actual.err &&
test_i18ngrep ! "usage" actual.err
grep "error" actual.err &&
! grep "usage" actual.err
'

test_expect_success 'tag --no-contains <existent_tag>' '
Expand All @@ -33,27 +33,27 @@ test_expect_success 'tag --no-contains <existent_tag>' '
test_expect_success 'tag --no-contains <inexistent_tag>' '
test_must_fail git tag --no-contains "notag" >actual 2>actual.err &&
test_line_count = 0 actual &&
test_i18ngrep "error" actual.err &&
test_i18ngrep ! "usage" actual.err
grep "error" actual.err &&
! grep "usage" actual.err
'

test_expect_success 'tag usage error' '
test_must_fail git tag --noopt >actual 2>actual.err &&
test_line_count = 0 actual &&
test_i18ngrep "usage" actual.err
grep "usage" actual.err
'

test_expect_success 'branch --contains <existent_commit>' '
git branch --contains "main" >actual 2>actual.err &&
test_i18ngrep "main" actual &&
grep "main" actual &&
test_line_count = 0 actual.err
'

test_expect_success 'branch --contains <inexistent_commit>' '
test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err &&
test_line_count = 0 actual &&
test_i18ngrep "error" actual.err &&
test_i18ngrep ! "usage" actual.err
grep "error" actual.err &&
! grep "usage" actual.err
'

test_expect_success 'branch --no-contains <existent_commit>' '
Expand All @@ -65,14 +65,14 @@ test_expect_success 'branch --no-contains <existent_commit>' '
test_expect_success 'branch --no-contains <inexistent_commit>' '
test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err &&
test_line_count = 0 actual &&
test_i18ngrep "error" actual.err &&
test_i18ngrep ! "usage" actual.err
grep "error" actual.err &&
! grep "usage" actual.err
'

test_expect_success 'branch usage error' '
test_must_fail git branch --noopt >actual 2>actual.err &&
test_line_count = 0 actual &&
test_i18ngrep "usage" actual.err
grep "usage" actual.err
'

test_expect_success 'for-each-ref --contains <existent_object>' '
Expand All @@ -84,8 +84,8 @@ test_expect_success 'for-each-ref --contains <existent_object>' '
test_expect_success 'for-each-ref --contains <inexistent_object>' '
test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err &&
test_line_count = 0 actual &&
test_i18ngrep "error" actual.err &&
test_i18ngrep ! "usage" actual.err
grep "error" actual.err &&
! grep "usage" actual.err
'

test_expect_success 'for-each-ref --no-contains <existent_object>' '
Expand All @@ -97,14 +97,14 @@ test_expect_success 'for-each-ref --no-contains <existent_object>' '
test_expect_success 'for-each-ref --no-contains <inexistent_object>' '
test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err &&
test_line_count = 0 actual &&
test_i18ngrep "error" actual.err &&
test_i18ngrep ! "usage" actual.err
grep "error" actual.err &&
! grep "usage" actual.err
'

test_expect_success 'for-each-ref usage error' '
test_must_fail git for-each-ref --noopt >actual 2>actual.err &&
test_line_count = 0 actual &&
test_i18ngrep "usage" actual.err
grep "usage" actual.err
'

test_done
22 changes: 11 additions & 11 deletions t/t1400-update-ref.sh
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ test_expect_success 'Query "main@{2005-05-26 23:33:01}" (middle of history with
git rev-parse --verify "main@{2005-05-26 23:33:01}" >o 2>e &&
echo "$B" >expect &&
test_cmp expect o &&
test_i18ngrep -F "warning: log for ref $m has gap after $gd" e
grep -F "warning: log for ref $m has gap after $gd" e
'
test_expect_success 'Query "main@{2005-05-26 23:38:00}" (middle of history)' '
test_when_finished "rm -f o e" &&
Expand All @@ -431,7 +431,7 @@ test_expect_success 'Query "main@{2005-05-28}" (past end of history)' '
git rev-parse --verify "main@{2005-05-28}" >o 2>e &&
echo "$D" >expect &&
test_cmp expect o &&
test_i18ngrep -F "warning: log for ref $m unexpectedly ended on $ld" e
grep -F "warning: log for ref $m unexpectedly ended on $ld" e
'

rm -f .git/$m .git/logs/$m expect
Expand Down Expand Up @@ -486,7 +486,7 @@ test_expect_success 'git cat-file blob main@{2005-05-26 23:42}:F (expect OTHER)'
test_expect_success 'given old value for missing pseudoref, do not create' '
test_must_fail git update-ref PSEUDOREF $A $B 2>err &&
test_must_fail git rev-parse PSEUDOREF &&
test_i18ngrep "unable to resolve reference" err
grep "unable to resolve reference" err
'

test_expect_success 'create pseudoref' '
Expand All @@ -507,7 +507,7 @@ test_expect_success 'overwrite pseudoref with correct old value' '
test_expect_success 'do not overwrite pseudoref with wrong old value' '
test_must_fail git update-ref PSEUDOREF $D $E 2>err &&
test $C = $(git rev-parse PSEUDOREF) &&
test_i18ngrep "cannot lock ref.*expected" err
grep "cannot lock ref.*expected" err
'

test_expect_success 'delete pseudoref' '
Expand All @@ -519,7 +519,7 @@ test_expect_success 'do not delete pseudoref with wrong old value' '
git update-ref PSEUDOREF $A &&
test_must_fail git update-ref -d PSEUDOREF $B 2>err &&
test $A = $(git rev-parse PSEUDOREF) &&
test_i18ngrep "cannot lock ref.*expected" err
grep "cannot lock ref.*expected" err
'

test_expect_success 'delete pseudoref with correct old value' '
Expand All @@ -536,7 +536,7 @@ test_expect_success 'do not overwrite pseudoref with old OID zero' '
test_when_finished git update-ref -d PSEUDOREF &&
test_must_fail git update-ref PSEUDOREF $B $Z 2>err &&
test $A = $(git rev-parse PSEUDOREF) &&
test_i18ngrep "already exists" err
grep "already exists" err
'

# Test --stdin
Expand All @@ -556,7 +556,7 @@ test_expect_success 'stdin test setup' '

test_expect_success '-z fails without --stdin' '
test_must_fail git update-ref -z $m $m $m 2>err &&
test_i18ngrep "usage: git update-ref" err
grep "usage: git update-ref" err
'

test_expect_success 'stdin works with no input' '
Expand Down Expand Up @@ -674,7 +674,7 @@ test_expect_success 'stdin fails with duplicate refs' '
create $a $m
EOF
test_must_fail git update-ref --stdin <stdin 2>err &&
test_i18ngrep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err
grep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err
'

test_expect_success 'stdin create ref works' '
Expand Down Expand Up @@ -1107,7 +1107,7 @@ test_expect_success 'stdin -z fails option with unknown name' '
test_expect_success 'stdin -z fails with duplicate refs' '
printf $F "create $a" "$m" "create $b" "$m" "create $a" "$m" >stdin &&
test_must_fail git update-ref -z --stdin <stdin 2>err &&
test_i18ngrep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err
grep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err
'

test_expect_success 'stdin -z create ref works' '
Expand Down Expand Up @@ -1338,7 +1338,7 @@ test_expect_success 'fails with duplicate HEAD update' '
update HEAD $B
EOF
test_must_fail git update-ref --stdin <stdin 2>err &&
test_i18ngrep "fatal: multiple updates for '\''HEAD'\'' (including one via its referent .refs/heads/target1.) are not allowed" err &&
grep "fatal: multiple updates for '\''HEAD'\'' (including one via its referent .refs/heads/target1.) are not allowed" err &&
echo "refs/heads/target1" >expect &&
git symbolic-ref HEAD >actual &&
test_cmp expect actual &&
Expand All @@ -1355,7 +1355,7 @@ test_expect_success 'fails with duplicate ref update via symref' '
update refs/heads/symref2 $B
EOF
test_must_fail git update-ref --stdin <stdin 2>err &&
test_i18ngrep "fatal: multiple updates for '\''refs/heads/target2'\'' (including one via symref .refs/heads/symref2.) are not allowed" err &&
grep "fatal: multiple updates for '\''refs/heads/target2'\'' (including one via symref .refs/heads/symref2.) are not allowed" err &&
echo "refs/heads/target2" >expect &&
git symbolic-ref refs/heads/symref2 >actual &&
test_cmp expect actual &&
Expand Down
22 changes: 11 additions & 11 deletions t/t1430-bad-ref-name.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ test_expect_success 'git branch shows badly named ref as warning' '
test-tool ref-store main update-ref msg "refs/heads/broken...ref" $main_sha1 $ZERO_OID REF_SKIP_REFNAME_VERIFICATION &&
test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...ref" &&
git branch >output 2>error &&
test_i18ngrep -e "ignoring ref with broken name refs/heads/broken\.\.\.ref" error &&
grep -e "ignoring ref with broken name refs/heads/broken\.\.\.ref" error &&
! grep -e "broken\.\.\.ref" output
'

Expand Down Expand Up @@ -158,7 +158,7 @@ test_expect_success 'rev-parse skips symref pointing to broken name' '
git rev-parse --verify one >expect &&
git rev-parse --verify shadow >actual 2>err &&
test_cmp expect actual &&
test_i18ngrep "ignoring dangling symref refs/tags/shadow" err
grep "ignoring dangling symref refs/tags/shadow" err
'

test_expect_success 'for-each-ref emits warnings for broken names' '
Expand All @@ -172,9 +172,9 @@ test_expect_success 'for-each-ref emits warnings for broken names' '
! grep -e "broken\.\.\.ref" output &&
! grep -e "badname" output &&
! grep -e "broken\.\.\.symref" output &&
test_i18ngrep "ignoring ref with broken name refs/heads/broken\.\.\.ref" error &&
test_i18ngrep ! "ignoring broken ref refs/heads/badname" error &&
test_i18ngrep "ignoring ref with broken name refs/heads/broken\.\.\.symref" error
grep "ignoring ref with broken name refs/heads/broken\.\.\.ref" error &&
! grep "ignoring broken ref refs/heads/badname" error &&
grep "ignoring ref with broken name refs/heads/broken\.\.\.symref" error
'

test_expect_success 'update-ref -d can delete broken name' '
Expand All @@ -192,7 +192,7 @@ test_expect_success 'branch -d can delete broken name' '
test-tool ref-store main update-ref msg "refs/heads/broken...ref" $main_sha1 $ZERO_OID REF_SKIP_REFNAME_VERIFICATION &&
test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...ref" &&
git branch -d broken...ref >output 2>error &&
test_i18ngrep "Deleted branch broken...ref (was broken)" output &&
grep "Deleted branch broken...ref (was broken)" output &&
test_must_be_empty error &&
git branch >output 2>error &&
! grep -e "broken\.\.\.ref" error &&
Expand All @@ -218,7 +218,7 @@ test_expect_success 'branch -d can delete symref to broken name' '
test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/badname" &&
git branch -d badname >output 2>error &&
test_path_is_missing .git/refs/heads/badname &&
test_i18ngrep "Deleted branch badname (was refs/heads/broken\.\.\.ref)" output &&
grep "Deleted branch badname (was refs/heads/broken\.\.\.ref)" output &&
test_must_be_empty error
'

Expand All @@ -236,7 +236,7 @@ test_expect_success 'branch -d can delete dangling symref to broken name' '
test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/badname" &&
git branch -d badname >output 2>error &&
test_path_is_missing .git/refs/heads/badname &&
test_i18ngrep "Deleted branch badname (was refs/heads/broken\.\.\.ref)" output &&
grep "Deleted branch badname (was refs/heads/broken\.\.\.ref)" output &&
test_must_be_empty error
'

Expand Down Expand Up @@ -265,7 +265,7 @@ test_expect_success 'branch -d can delete symref with broken name' '
test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" &&
git branch -d broken...symref >output 2>error &&
test_path_is_missing .git/refs/heads/broken...symref &&
test_i18ngrep "Deleted branch broken...symref (was refs/heads/main)" output &&
grep "Deleted branch broken...symref (was refs/heads/main)" output &&
test_must_be_empty error
'

Expand All @@ -283,7 +283,7 @@ test_expect_success 'branch -d can delete dangling symref with broken name' '
test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" &&
git branch -d broken...symref >output 2>error &&
test_path_is_missing .git/refs/heads/broken...symref &&
test_i18ngrep "Deleted branch broken...symref (was refs/heads/idonotexist)" output &&
grep "Deleted branch broken...symref (was refs/heads/idonotexist)" output &&
test_must_be_empty error
'

Expand All @@ -292,7 +292,7 @@ test_expect_success 'update-ref -d cannot delete non-ref in .git dir' '
echo precious >expect &&
test_must_fail git update-ref -d my-private-file >output 2>error &&
test_must_be_empty output &&
test_i18ngrep -e "refusing to update ref with bad name" error &&
grep -e "refusing to update ref with bad name" error &&
test_cmp expect .git/my-private-file
'

Expand Down
Loading

0 comments on commit be905b3

Please sign in to comment.