Skip to content

Commit

Permalink
t7810: add missing variables to tests in loop
Browse files Browse the repository at this point in the history
Some tests in t7810-grep.sh are in a loop that runs them against HEAD and
the work tree.  In order for that to work the test code should use the
variables $L (display name), $H (HEAD or empty string) and $HC (revision
prefix for result lines); otherwise tests are just repeated with the same
target.  Add the variables where they're missing and make sure the test
description is wrapped in double quotes (instead of single quotes) to
allow variables to be expanded.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
René Scharfe authored and Junio C Hamano committed Mar 11, 2014
1 parent 5f95c9f commit 9afad7a
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions t/t7810-grep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ do

test_expect_success "grep -w $L (w)" '
: >expected &&
test_must_fail git grep -n -w -e "^w" >actual &&
test_must_fail git grep -n -w -e "^w" $H >actual &&
test_cmp expected actual
'

Expand Down Expand Up @@ -240,92 +240,92 @@ do
test_cmp expected actual
'
test_expect_success "grep $L with grep.extendedRegexp=false" '
echo "ab:a+bc" >expected &&
git -c grep.extendedRegexp=false grep "a+b*c" ab >actual &&
echo "${HC}ab:a+bc" >expected &&
git -c grep.extendedRegexp=false grep "a+b*c" $H ab >actual &&
test_cmp expected actual
'

test_expect_success "grep $L with grep.extendedRegexp=true" '
echo "ab:abc" >expected &&
git -c grep.extendedRegexp=true grep "a+b*c" ab >actual &&
echo "${HC}ab:abc" >expected &&
git -c grep.extendedRegexp=true grep "a+b*c" $H ab >actual &&
test_cmp expected actual
'

test_expect_success "grep $L with grep.patterntype=basic" '
echo "ab:a+bc" >expected &&
git -c grep.patterntype=basic grep "a+b*c" ab >actual &&
echo "${HC}ab:a+bc" >expected &&
git -c grep.patterntype=basic grep "a+b*c" $H ab >actual &&
test_cmp expected actual
'

test_expect_success "grep $L with grep.patterntype=extended" '
echo "ab:abc" >expected &&
git -c grep.patterntype=extended grep "a+b*c" ab >actual &&
echo "${HC}ab:abc" >expected &&
git -c grep.patterntype=extended grep "a+b*c" $H ab >actual &&
test_cmp expected actual
'

test_expect_success "grep $L with grep.patterntype=fixed" '
echo "ab:a+b*c" >expected &&
git -c grep.patterntype=fixed grep "a+b*c" ab >actual &&
echo "${HC}ab:a+b*c" >expected &&
git -c grep.patterntype=fixed grep "a+b*c" $H ab >actual &&
test_cmp expected actual
'

test_expect_success LIBPCRE "grep $L with grep.patterntype=perl" '
echo "ab:a+b*c" >expected &&
git -c grep.patterntype=perl grep "a\x{2b}b\x{2a}c" ab >actual &&
echo "${HC}ab:a+b*c" >expected &&
git -c grep.patterntype=perl grep "a\x{2b}b\x{2a}c" $H ab >actual &&
test_cmp expected actual
'

test_expect_success "grep $L with grep.patternType=default and grep.extendedRegexp=true" '
echo "ab:abc" >expected &&
echo "${HC}ab:abc" >expected &&
git \
-c grep.patternType=default \
-c grep.extendedRegexp=true \
grep "a+b*c" ab >actual &&
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
'

test_expect_success "grep $L with grep.extendedRegexp=true and grep.patternType=default" '
echo "ab:abc" >expected &&
echo "${HC}ab:abc" >expected &&
git \
-c grep.extendedRegexp=true \
-c grep.patternType=default \
grep "a+b*c" ab >actual &&
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
'

test_expect_success 'grep $L with grep.patternType=extended and grep.extendedRegexp=false' '
echo "ab:abc" >expected &&
test_expect_success "grep $L with grep.patternType=extended and grep.extendedRegexp=false" '
echo "${HC}ab:abc" >expected &&
git \
-c grep.patternType=extended \
-c grep.extendedRegexp=false \
grep "a+b*c" ab >actual &&
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
'

test_expect_success 'grep $L with grep.patternType=basic and grep.extendedRegexp=true' '
echo "ab:a+bc" >expected &&
test_expect_success "grep $L with grep.patternType=basic and grep.extendedRegexp=true" '
echo "${HC}ab:a+bc" >expected &&
git \
-c grep.patternType=basic \
-c grep.extendedRegexp=true \
grep "a+b*c" ab >actual &&
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
'

test_expect_success 'grep $L with grep.extendedRegexp=false and grep.patternType=extended' '
echo "ab:abc" >expected &&
test_expect_success "grep $L with grep.extendedRegexp=false and grep.patternType=extended" '
echo "${HC}ab:abc" >expected &&
git \
-c grep.extendedRegexp=false \
-c grep.patternType=extended \
grep "a+b*c" ab >actual &&
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
'

test_expect_success 'grep $L with grep.extendedRegexp=true and grep.patternType=basic' '
echo "ab:a+bc" >expected &&
test_expect_success "grep $L with grep.extendedRegexp=true and grep.patternType=basic" '
echo "${HC}ab:a+bc" >expected &&
git \
-c grep.extendedRegexp=true \
-c grep.patternType=basic \
grep "a+b*c" ab >actual &&
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
'
done
Expand Down

0 comments on commit 9afad7a

Please sign in to comment.