tests: simplify construction of large blocks of text
Take advantage of here-docs to create large blocks of text rather than using a series of `echo` statements. Not only are here-docs a natural fit for such a task, but there is less opportunity for a broken &&-chain. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
2041b0e8e8
commit
020b813f40
|
@ -118,17 +118,17 @@ test_expect_success check '
|
||||||
# If an expanded ident ever gets into the repository, we want to make sure that
|
# If an expanded ident ever gets into the repository, we want to make sure that
|
||||||
# it is collapsed before being expanded again on checkout
|
# it is collapsed before being expanded again on checkout
|
||||||
test_expect_success expanded_in_repo '
|
test_expect_success expanded_in_repo '
|
||||||
{
|
cat >expanded-keywords.0 <<-\EOF &&
|
||||||
echo "File with expanded keywords"
|
File with expanded keywords
|
||||||
echo "\$Id\$"
|
$Id$
|
||||||
echo "\$Id:\$"
|
$Id:$
|
||||||
echo "\$Id: 0000000000000000000000000000000000000000 \$"
|
$Id: 0000000000000000000000000000000000000000 $
|
||||||
echo "\$Id: NoSpaceAtEnd\$"
|
$Id: NoSpaceAtEnd$
|
||||||
echo "\$Id:NoSpaceAtFront \$"
|
$Id:NoSpaceAtFront $
|
||||||
echo "\$Id:NoSpaceAtEitherEnd\$"
|
$Id:NoSpaceAtEitherEnd$
|
||||||
echo "\$Id: NoTerminatingSymbol"
|
$Id: NoTerminatingSymbol
|
||||||
echo "\$Id: Foreign Commit With Spaces \$"
|
$Id: Foreign Commit With Spaces $
|
||||||
} >expanded-keywords.0 &&
|
EOF
|
||||||
|
|
||||||
{
|
{
|
||||||
cat expanded-keywords.0 &&
|
cat expanded-keywords.0 &&
|
||||||
|
@ -139,17 +139,17 @@ test_expect_success expanded_in_repo '
|
||||||
git commit -m "File with keywords expanded" &&
|
git commit -m "File with keywords expanded" &&
|
||||||
id=$(git rev-parse --verify :expanded-keywords) &&
|
id=$(git rev-parse --verify :expanded-keywords) &&
|
||||||
|
|
||||||
{
|
cat >expected-output.0 <<-EOF &&
|
||||||
echo "File with expanded keywords"
|
File with expanded keywords
|
||||||
echo "\$Id: $id \$"
|
\$Id: $id \$
|
||||||
echo "\$Id: $id \$"
|
\$Id: $id \$
|
||||||
echo "\$Id: $id \$"
|
\$Id: $id \$
|
||||||
echo "\$Id: $id \$"
|
\$Id: $id \$
|
||||||
echo "\$Id: $id \$"
|
\$Id: $id \$
|
||||||
echo "\$Id: $id \$"
|
\$Id: $id \$
|
||||||
echo "\$Id: NoTerminatingSymbol"
|
\$Id: NoTerminatingSymbol
|
||||||
echo "\$Id: Foreign Commit With Spaces \$"
|
\$Id: Foreign Commit With Spaces \$
|
||||||
} >expected-output.0 &&
|
EOF
|
||||||
{
|
{
|
||||||
cat expected-output.0 &&
|
cat expected-output.0 &&
|
||||||
printf "\$Id: NoTerminatingSymbolAtEOF"
|
printf "\$Id: NoTerminatingSymbolAtEOF"
|
||||||
|
|
|
@ -18,7 +18,10 @@ test_expect_success 'git apply --numstat - < patch' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'git apply --numstat - < patch patch' '
|
test_expect_success 'git apply --numstat - < patch patch' '
|
||||||
for i in 1 2; do echo "1 1 text"; done >expect &&
|
cat >expect <<-\EOF &&
|
||||||
|
1 1 text
|
||||||
|
1 1 text
|
||||||
|
EOF
|
||||||
git apply --numstat - < patch patch >actual &&
|
git apply --numstat - < patch patch >actual &&
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
'
|
'
|
||||||
|
|
|
@ -40,11 +40,11 @@ test_expect_success "clone and setup child repos" '
|
||||||
git config branch.main.remote two &&
|
git config branch.main.remote two &&
|
||||||
git config branch.main.merge refs/heads/one &&
|
git config branch.main.merge refs/heads/one &&
|
||||||
mkdir -p .git/remotes &&
|
mkdir -p .git/remotes &&
|
||||||
{
|
cat >.git/remotes/two <<-\EOF
|
||||||
echo "URL: ../two/.git/"
|
URL: ../two/.git/
|
||||||
echo "Pull: refs/heads/main:refs/heads/two"
|
Pull: refs/heads/main:refs/heads/two
|
||||||
echo "Pull: refs/heads/one:refs/heads/one"
|
Pull: refs/heads/one:refs/heads/one
|
||||||
} >.git/remotes/two
|
EOF
|
||||||
) &&
|
) &&
|
||||||
git clone . bundle &&
|
git clone . bundle &&
|
||||||
git clone . seven
|
git clone . seven
|
||||||
|
|
|
@ -105,19 +105,19 @@ test_expect_success setup '
|
||||||
remotes="$remotes config-glob" &&
|
remotes="$remotes config-glob" &&
|
||||||
|
|
||||||
mkdir -p .git/remotes &&
|
mkdir -p .git/remotes &&
|
||||||
{
|
cat >.git/remotes/remote-explicit <<-\EOF &&
|
||||||
echo "URL: ../.git/"
|
URL: ../.git/
|
||||||
echo "Pull: refs/heads/main:remotes/rem/main"
|
Pull: refs/heads/main:remotes/rem/main
|
||||||
echo "Pull: refs/heads/one:remotes/rem/one"
|
Pull: refs/heads/one:remotes/rem/one
|
||||||
echo "Pull: two:remotes/rem/two"
|
Pull: two:remotes/rem/two
|
||||||
echo "Pull: refs/heads/three:remotes/rem/three"
|
Pull: refs/heads/three:remotes/rem/three
|
||||||
} >.git/remotes/remote-explicit &&
|
EOF
|
||||||
remotes="$remotes remote-explicit" &&
|
remotes="$remotes remote-explicit" &&
|
||||||
|
|
||||||
{
|
cat >.git/remotes/remote-glob <<-\EOF &&
|
||||||
echo "URL: ../.git/"
|
URL: ../.git/
|
||||||
echo "Pull: refs/heads/*:refs/remotes/rem/*"
|
Pull: refs/heads/*:refs/remotes/rem/*
|
||||||
} >.git/remotes/remote-glob &&
|
EOF
|
||||||
remotes="$remotes remote-glob" &&
|
remotes="$remotes remote-glob" &&
|
||||||
|
|
||||||
mkdir -p .git/branches &&
|
mkdir -p .git/branches &&
|
||||||
|
|
|
@ -62,10 +62,10 @@ test_expect_success setup '
|
||||||
|
|
||||||
test_expect_success merge '
|
test_expect_success merge '
|
||||||
|
|
||||||
{
|
cat >.gitattributes <<-\EOF &&
|
||||||
echo "binary -merge"
|
binary -merge
|
||||||
echo "union merge=union"
|
union merge=union
|
||||||
} >.gitattributes &&
|
EOF
|
||||||
|
|
||||||
if git merge main
|
if git merge main
|
||||||
then
|
then
|
||||||
|
|
|
@ -51,10 +51,10 @@ test_expect_success 'set up mode change in both branches' '
|
||||||
: >file2 &&
|
: >file2 &&
|
||||||
git add file2 &&
|
git add file2 &&
|
||||||
git commit -m b2 &&
|
git commit -m b2 &&
|
||||||
{
|
cat >expect <<-EOF
|
||||||
echo "100755 $H 2 file2"
|
100755 $H 2 file2
|
||||||
echo "100644 $H 3 file2"
|
100644 $H 3 file2
|
||||||
} >expect
|
EOF
|
||||||
'
|
'
|
||||||
|
|
||||||
do_both_modes () {
|
do_both_modes () {
|
||||||
|
|
310
t/t7810-grep.sh
310
t/t7810-grep.sh
|
@ -31,28 +31,28 @@ int main(int argc, const char **argv)
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_expect_success setup '
|
test_expect_success setup '
|
||||||
{
|
cat >file <<-\EOF &&
|
||||||
echo foo mmap bar
|
foo mmap bar
|
||||||
echo foo_mmap bar
|
foo_mmap bar
|
||||||
echo foo_mmap bar mmap
|
foo_mmap bar mmap
|
||||||
echo foo mmap bar_mmap
|
foo mmap bar_mmap
|
||||||
echo foo_mmap bar mmap baz
|
foo_mmap bar mmap baz
|
||||||
} >file &&
|
EOF
|
||||||
{
|
cat >hello_world <<-\EOF &&
|
||||||
echo Hello world
|
Hello world
|
||||||
echo HeLLo world
|
HeLLo world
|
||||||
echo Hello_world
|
Hello_world
|
||||||
echo HeLLo_world
|
HeLLo_world
|
||||||
} >hello_world &&
|
EOF
|
||||||
{
|
cat >ab <<-\EOF &&
|
||||||
echo "a+b*c"
|
a+b*c
|
||||||
echo "a+bc"
|
a+bc
|
||||||
echo "abc"
|
abc
|
||||||
} >ab &&
|
EOF
|
||||||
{
|
cat >d0 <<-\EOF &&
|
||||||
echo d &&
|
d
|
||||||
echo 0
|
0
|
||||||
} >d0 &&
|
EOF
|
||||||
echo vvv >v &&
|
echo vvv >v &&
|
||||||
echo ww w >w &&
|
echo ww w >w &&
|
||||||
echo x x xx x >x &&
|
echo x x xx x >x &&
|
||||||
|
@ -63,13 +63,13 @@ test_expect_success setup '
|
||||||
echo vvv >t/v &&
|
echo vvv >t/v &&
|
||||||
mkdir t/a &&
|
mkdir t/a &&
|
||||||
echo vvv >t/a/v &&
|
echo vvv >t/a/v &&
|
||||||
{
|
qz_to_tab_space >space <<-\EOF &&
|
||||||
echo "line without leading space1"
|
line without leading space1
|
||||||
echo " line with leading space1"
|
Zline with leading space1
|
||||||
echo " line with leading space2"
|
Zline with leading space2
|
||||||
echo " line with leading space3"
|
Zline with leading space3
|
||||||
echo "line without leading space2"
|
line without leading space2
|
||||||
} >space &&
|
EOF
|
||||||
cat >hello.ps1 <<-\EOF &&
|
cat >hello.ps1 <<-\EOF &&
|
||||||
# No-op.
|
# No-op.
|
||||||
function dummy() {}
|
function dummy() {}
|
||||||
|
@ -106,129 +106,129 @@ do
|
||||||
esac
|
esac
|
||||||
|
|
||||||
test_expect_success "grep -w $L" '
|
test_expect_success "grep -w $L" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}file:1:foo mmap bar
|
${HC}file:1:foo mmap bar
|
||||||
echo ${HC}file:3:foo_mmap bar mmap
|
${HC}file:3:foo_mmap bar mmap
|
||||||
echo ${HC}file:4:foo mmap bar_mmap
|
${HC}file:4:foo mmap bar_mmap
|
||||||
echo ${HC}file:5:foo_mmap bar mmap baz
|
${HC}file:5:foo_mmap bar mmap baz
|
||||||
} >expected &&
|
EOF
|
||||||
git -c grep.linenumber=false grep -n -w -e mmap $H >actual &&
|
git -c grep.linenumber=false grep -n -w -e mmap $H >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep -w $L (with --column)" '
|
test_expect_success "grep -w $L (with --column)" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}file:5:foo mmap bar
|
${HC}file:5:foo mmap bar
|
||||||
echo ${HC}file:14:foo_mmap bar mmap
|
${HC}file:14:foo_mmap bar mmap
|
||||||
echo ${HC}file:5:foo mmap bar_mmap
|
${HC}file:5:foo mmap bar_mmap
|
||||||
echo ${HC}file:14:foo_mmap bar mmap baz
|
${HC}file:14:foo_mmap bar mmap baz
|
||||||
} >expected &&
|
EOF
|
||||||
git grep --column -w -e mmap $H >actual &&
|
git grep --column -w -e mmap $H >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep -w $L (with --column, extended OR)" '
|
test_expect_success "grep -w $L (with --column, extended OR)" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}file:14:foo_mmap bar mmap
|
${HC}file:14:foo_mmap bar mmap
|
||||||
echo ${HC}file:19:foo_mmap bar mmap baz
|
${HC}file:19:foo_mmap bar mmap baz
|
||||||
} >expected &&
|
EOF
|
||||||
git grep --column -w -e mmap$ --or -e baz $H >actual &&
|
git grep --column -w -e mmap$ --or -e baz $H >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep -w $L (with --column, --invert-match)" '
|
test_expect_success "grep -w $L (with --column, --invert-match)" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}file:1:foo mmap bar
|
${HC}file:1:foo mmap bar
|
||||||
echo ${HC}file:1:foo_mmap bar
|
${HC}file:1:foo_mmap bar
|
||||||
echo ${HC}file:1:foo_mmap bar mmap
|
${HC}file:1:foo_mmap bar mmap
|
||||||
echo ${HC}file:1:foo mmap bar_mmap
|
${HC}file:1:foo mmap bar_mmap
|
||||||
} >expected &&
|
EOF
|
||||||
git grep --column --invert-match -w -e baz $H -- file >actual &&
|
git grep --column --invert-match -w -e baz $H -- file >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep $L (with --column, --invert-match, extended OR)" '
|
test_expect_success "grep $L (with --column, --invert-match, extended OR)" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}hello_world:6:HeLLo_world
|
${HC}hello_world:6:HeLLo_world
|
||||||
} >expected &&
|
EOF
|
||||||
git grep --column --invert-match -e ll --or --not -e _ $H -- hello_world \
|
git grep --column --invert-match -e ll --or --not -e _ $H -- hello_world \
|
||||||
>actual &&
|
>actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep $L (with --column, --invert-match, extended AND)" '
|
test_expect_success "grep $L (with --column, --invert-match, extended AND)" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}hello_world:3:Hello world
|
${HC}hello_world:3:Hello world
|
||||||
echo ${HC}hello_world:3:Hello_world
|
${HC}hello_world:3:Hello_world
|
||||||
echo ${HC}hello_world:6:HeLLo_world
|
${HC}hello_world:6:HeLLo_world
|
||||||
} >expected &&
|
EOF
|
||||||
git grep --column --invert-match --not -e _ --and --not -e ll $H -- hello_world \
|
git grep --column --invert-match --not -e _ --and --not -e ll $H -- hello_world \
|
||||||
>actual &&
|
>actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep $L (with --column, double-negation)" '
|
test_expect_success "grep $L (with --column, double-negation)" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}file:1:foo_mmap bar mmap baz
|
${HC}file:1:foo_mmap bar mmap baz
|
||||||
} >expected &&
|
EOF
|
||||||
git grep --column --not \( --not -e foo --or --not -e baz \) $H -- file \
|
git grep --column --not \( --not -e foo --or --not -e baz \) $H -- file \
|
||||||
>actual &&
|
>actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep -w $L (with --column, -C)" '
|
test_expect_success "grep -w $L (with --column, -C)" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}file:5:foo mmap bar
|
${HC}file:5:foo mmap bar
|
||||||
echo ${HC}file-foo_mmap bar
|
${HC}file-foo_mmap bar
|
||||||
echo ${HC}file:14:foo_mmap bar mmap
|
${HC}file:14:foo_mmap bar mmap
|
||||||
echo ${HC}file:5:foo mmap bar_mmap
|
${HC}file:5:foo mmap bar_mmap
|
||||||
echo ${HC}file:14:foo_mmap bar mmap baz
|
${HC}file:14:foo_mmap bar mmap baz
|
||||||
} >expected &&
|
EOF
|
||||||
git grep --column -w -C1 -e mmap $H >actual &&
|
git grep --column -w -C1 -e mmap $H >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep -w $L (with --line-number, --column)" '
|
test_expect_success "grep -w $L (with --line-number, --column)" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}file:1:5:foo mmap bar
|
${HC}file:1:5:foo mmap bar
|
||||||
echo ${HC}file:3:14:foo_mmap bar mmap
|
${HC}file:3:14:foo_mmap bar mmap
|
||||||
echo ${HC}file:4:5:foo mmap bar_mmap
|
${HC}file:4:5:foo mmap bar_mmap
|
||||||
echo ${HC}file:5:14:foo_mmap bar mmap baz
|
${HC}file:5:14:foo_mmap bar mmap baz
|
||||||
} >expected &&
|
EOF
|
||||||
git grep -n --column -w -e mmap $H >actual &&
|
git grep -n --column -w -e mmap $H >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep -w $L (with non-extended patterns, --column)" '
|
test_expect_success "grep -w $L (with non-extended patterns, --column)" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}file:5:foo mmap bar
|
${HC}file:5:foo mmap bar
|
||||||
echo ${HC}file:10:foo_mmap bar
|
${HC}file:10:foo_mmap bar
|
||||||
echo ${HC}file:10:foo_mmap bar mmap
|
${HC}file:10:foo_mmap bar mmap
|
||||||
echo ${HC}file:5:foo mmap bar_mmap
|
${HC}file:5:foo mmap bar_mmap
|
||||||
echo ${HC}file:10:foo_mmap bar mmap baz
|
${HC}file:10:foo_mmap bar mmap baz
|
||||||
} >expected &&
|
EOF
|
||||||
git grep --column -w -e bar -e mmap $H >actual &&
|
git grep --column -w -e bar -e mmap $H >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep -w $L" '
|
test_expect_success "grep -w $L" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}file:1:foo mmap bar
|
${HC}file:1:foo mmap bar
|
||||||
echo ${HC}file:3:foo_mmap bar mmap
|
${HC}file:3:foo_mmap bar mmap
|
||||||
echo ${HC}file:4:foo mmap bar_mmap
|
${HC}file:4:foo mmap bar_mmap
|
||||||
echo ${HC}file:5:foo_mmap bar mmap baz
|
${HC}file:5:foo_mmap bar mmap baz
|
||||||
} >expected &&
|
EOF
|
||||||
git -c grep.linenumber=true grep -w -e mmap $H >actual &&
|
git -c grep.linenumber=true grep -w -e mmap $H >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep -w $L" '
|
test_expect_success "grep -w $L" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}file:foo mmap bar
|
${HC}file:foo mmap bar
|
||||||
echo ${HC}file:foo_mmap bar mmap
|
${HC}file:foo_mmap bar mmap
|
||||||
echo ${HC}file:foo mmap bar_mmap
|
${HC}file:foo mmap bar_mmap
|
||||||
echo ${HC}file:foo_mmap bar mmap baz
|
${HC}file:foo_mmap bar mmap baz
|
||||||
} >expected &&
|
EOF
|
||||||
git -c grep.linenumber=true grep --no-line-number -w -e mmap $H >actual &&
|
git -c grep.linenumber=true grep --no-line-number -w -e mmap $H >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
@ -239,17 +239,17 @@ do
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep -w $L (x)" '
|
test_expect_success "grep -w $L (x)" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}x:1:x x xx x
|
${HC}x:1:x x xx x
|
||||||
} >expected &&
|
EOF
|
||||||
git grep -n -w -e "x xx* x" $H >actual &&
|
git grep -n -w -e "x xx* x" $H >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep -w $L (y-1)" '
|
test_expect_success "grep -w $L (y-1)" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}y:1:y yy
|
${HC}y:1:y yy
|
||||||
} >expected &&
|
EOF
|
||||||
git grep -n -w -e "^y" $H >actual &&
|
git grep -n -w -e "^y" $H >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
@ -277,16 +277,16 @@ do
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep $L (with --column, --only-matching)" '
|
test_expect_success "grep $L (with --column, --only-matching)" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}file:1:5:mmap
|
${HC}file:1:5:mmap
|
||||||
echo ${HC}file:2:5:mmap
|
${HC}file:2:5:mmap
|
||||||
echo ${HC}file:3:5:mmap
|
${HC}file:3:5:mmap
|
||||||
echo ${HC}file:3:13:mmap
|
${HC}file:3:13:mmap
|
||||||
echo ${HC}file:4:5:mmap
|
${HC}file:4:5:mmap
|
||||||
echo ${HC}file:4:13:mmap
|
${HC}file:4:13:mmap
|
||||||
echo ${HC}file:5:5:mmap
|
${HC}file:5:5:mmap
|
||||||
echo ${HC}file:5:13:mmap
|
${HC}file:5:13:mmap
|
||||||
} >expected &&
|
EOF
|
||||||
git grep --column -n -o -e mmap $H >actual &&
|
git grep --column -n -o -e mmap $H >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
@ -320,11 +320,11 @@ do
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep --max-depth -1 $L" '
|
test_expect_success "grep --max-depth -1 $L" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}t/a/v:1:vvv
|
${HC}t/a/v:1:vvv
|
||||||
echo ${HC}t/v:1:vvv
|
${HC}t/v:1:vvv
|
||||||
echo ${HC}v:1:vvv
|
${HC}v:1:vvv
|
||||||
} >expected &&
|
EOF
|
||||||
git grep --max-depth -1 -n -e vvv $H >actual &&
|
git grep --max-depth -1 -n -e vvv $H >actual &&
|
||||||
test_cmp expected actual &&
|
test_cmp expected actual &&
|
||||||
git grep --recursive -n -e vvv $H >actual &&
|
git grep --recursive -n -e vvv $H >actual &&
|
||||||
|
@ -332,9 +332,9 @@ do
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep --max-depth 0 $L" '
|
test_expect_success "grep --max-depth 0 $L" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}v:1:vvv
|
${HC}v:1:vvv
|
||||||
} >expected &&
|
EOF
|
||||||
git grep --max-depth 0 -n -e vvv $H >actual &&
|
git grep --max-depth 0 -n -e vvv $H >actual &&
|
||||||
test_cmp expected actual &&
|
test_cmp expected actual &&
|
||||||
git grep --no-recursive -n -e vvv $H >actual &&
|
git grep --no-recursive -n -e vvv $H >actual &&
|
||||||
|
@ -342,11 +342,11 @@ do
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep --max-depth 0 -- '*' $L" '
|
test_expect_success "grep --max-depth 0 -- '*' $L" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}t/a/v:1:vvv
|
${HC}t/a/v:1:vvv
|
||||||
echo ${HC}t/v:1:vvv
|
${HC}t/v:1:vvv
|
||||||
echo ${HC}v:1:vvv
|
${HC}v:1:vvv
|
||||||
} >expected &&
|
EOF
|
||||||
git grep --max-depth 0 -n -e vvv $H -- "*" >actual &&
|
git grep --max-depth 0 -n -e vvv $H -- "*" >actual &&
|
||||||
test_cmp expected actual &&
|
test_cmp expected actual &&
|
||||||
git grep --no-recursive -n -e vvv $H -- "*" >actual &&
|
git grep --no-recursive -n -e vvv $H -- "*" >actual &&
|
||||||
|
@ -354,18 +354,18 @@ do
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep --max-depth 1 $L" '
|
test_expect_success "grep --max-depth 1 $L" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}t/v:1:vvv
|
${HC}t/v:1:vvv
|
||||||
echo ${HC}v:1:vvv
|
${HC}v:1:vvv
|
||||||
} >expected &&
|
EOF
|
||||||
git grep --max-depth 1 -n -e vvv $H >actual &&
|
git grep --max-depth 1 -n -e vvv $H >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep --max-depth 0 -- t $L" '
|
test_expect_success "grep --max-depth 0 -- t $L" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}t/v:1:vvv
|
${HC}t/v:1:vvv
|
||||||
} >expected &&
|
EOF
|
||||||
git grep --max-depth 0 -n -e vvv $H -- t >actual &&
|
git grep --max-depth 0 -n -e vvv $H -- t >actual &&
|
||||||
test_cmp expected actual &&
|
test_cmp expected actual &&
|
||||||
git grep --no-recursive -n -e vvv $H -- t >actual &&
|
git grep --no-recursive -n -e vvv $H -- t >actual &&
|
||||||
|
@ -373,10 +373,10 @@ do
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep --max-depth 0 -- . t $L" '
|
test_expect_success "grep --max-depth 0 -- . t $L" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}t/v:1:vvv
|
${HC}t/v:1:vvv
|
||||||
echo ${HC}v:1:vvv
|
${HC}v:1:vvv
|
||||||
} >expected &&
|
EOF
|
||||||
git grep --max-depth 0 -n -e vvv $H -- . t >actual &&
|
git grep --max-depth 0 -n -e vvv $H -- . t >actual &&
|
||||||
test_cmp expected actual &&
|
test_cmp expected actual &&
|
||||||
git grep --no-recursive -n -e vvv $H -- . t >actual &&
|
git grep --no-recursive -n -e vvv $H -- . t >actual &&
|
||||||
|
@ -384,10 +384,10 @@ do
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "grep --max-depth 0 -- t . $L" '
|
test_expect_success "grep --max-depth 0 -- t . $L" '
|
||||||
{
|
cat >expected <<-EOF &&
|
||||||
echo ${HC}t/v:1:vvv
|
${HC}t/v:1:vvv
|
||||||
echo ${HC}v:1:vvv
|
${HC}v:1:vvv
|
||||||
} >expected &&
|
EOF
|
||||||
git grep --max-depth 0 -n -e vvv $H -- t . >actual &&
|
git grep --max-depth 0 -n -e vvv $H -- t . >actual &&
|
||||||
test_cmp expected actual &&
|
test_cmp expected actual &&
|
||||||
git grep --no-recursive -n -e vvv $H -- t . >actual &&
|
git grep --no-recursive -n -e vvv $H -- t . >actual &&
|
||||||
|
@ -1314,10 +1314,10 @@ test_expect_success PCRE 'grep -P pattern with grep.extendedRegexp=true' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success PCRE 'grep -P -v pattern' '
|
test_expect_success PCRE 'grep -P -v pattern' '
|
||||||
{
|
cat >expected <<-\EOF &&
|
||||||
echo "ab:a+b*c"
|
ab:a+b*c
|
||||||
echo "ab:a+bc"
|
ab:a+bc
|
||||||
} >expected &&
|
EOF
|
||||||
git grep -P -v "abc" ab >actual &&
|
git grep -P -v "abc" ab >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
@ -1331,10 +1331,10 @@ test_expect_success PCRE 'grep -P -i pattern' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success PCRE 'grep -P -w pattern' '
|
test_expect_success PCRE 'grep -P -w pattern' '
|
||||||
{
|
cat >expected <<-\EOF &&
|
||||||
echo "hello_world:Hello world"
|
hello_world:Hello world
|
||||||
echo "hello_world:HeLLo world"
|
hello_world:HeLLo world
|
||||||
} >expected &&
|
EOF
|
||||||
git grep -P -w "He((?i)ll)o" hello_world >actual &&
|
git grep -P -w "He((?i)ll)o" hello_world >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
@ -1469,10 +1469,10 @@ test_expect_success 'grep -F pattern with grep.patternType=basic' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'grep -G pattern with grep.patternType=fixed' '
|
test_expect_success 'grep -G pattern with grep.patternType=fixed' '
|
||||||
{
|
cat >expected <<-\EOF &&
|
||||||
echo "ab:a+b*c"
|
ab:a+b*c
|
||||||
echo "ab:a+bc"
|
ab:a+bc
|
||||||
} >expected &&
|
EOF
|
||||||
git \
|
git \
|
||||||
-c grep.patterntype=fixed \
|
-c grep.patterntype=fixed \
|
||||||
grep -G "a+b" ab >actual &&
|
grep -G "a+b" ab >actual &&
|
||||||
|
@ -1480,11 +1480,11 @@ test_expect_success 'grep -G pattern with grep.patternType=fixed' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'grep -E pattern with grep.patternType=fixed' '
|
test_expect_success 'grep -E pattern with grep.patternType=fixed' '
|
||||||
{
|
cat >expected <<-\EOF &&
|
||||||
echo "ab:a+b*c"
|
ab:a+b*c
|
||||||
echo "ab:a+bc"
|
ab:a+bc
|
||||||
echo "ab:abc"
|
ab:abc
|
||||||
} >expected &&
|
EOF
|
||||||
git \
|
git \
|
||||||
-c grep.patterntype=fixed \
|
-c grep.patterntype=fixed \
|
||||||
grep -E "a+" ab >actual &&
|
grep -E "a+" ab >actual &&
|
||||||
|
|
Loading…
Reference in New Issue