Merge branch 'jk/grep-e-could-be-extended-beyond-posix' into maint

Tighten a test to avoid mistaking an extended ERE regexp engine as
a PRE regexp engine.

* jk/grep-e-could-be-extended-beyond-posix:
  t7810: avoid assumption about invalid regex syntax
This commit is contained in:
Junio C Hamano 2017-01-31 13:32:09 -08:00
commit 14beee0d0d

View File

@ -39,6 +39,10 @@ test_expect_success setup '
echo "a+bc" echo "a+bc"
echo "abc" echo "abc"
} >ab && } >ab &&
{
echo d &&
echo 0
} >d0 &&
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 &&
@ -1105,36 +1109,36 @@ test_expect_success 'grep pattern with grep.patternType=fixed, =basic, =extended
' '
test_expect_success 'grep -G -F -P -E pattern' ' test_expect_success 'grep -G -F -P -E pattern' '
>empty && echo "d0:d" >expected &&
test_must_fail git grep -G -F -P -E "a\x{2b}b\x{2a}c" ab >actual && git grep -G -F -P -E "[\d]" d0 >actual &&
test_cmp empty actual test_cmp expected actual
' '
test_expect_success 'grep pattern with grep.patternType=fixed, =basic, =perl, =extended' ' test_expect_success 'grep pattern with grep.patternType=fixed, =basic, =perl, =extended' '
>empty && echo "d0:d" >expected &&
test_must_fail git \ git \
-c grep.patterntype=fixed \ -c grep.patterntype=fixed \
-c grep.patterntype=basic \ -c grep.patterntype=basic \
-c grep.patterntype=perl \ -c grep.patterntype=perl \
-c grep.patterntype=extended \ -c grep.patterntype=extended \
grep "a\x{2b}b\x{2a}c" ab >actual && grep "[\d]" d0 >actual &&
test_cmp empty actual test_cmp expected actual
' '
test_expect_success LIBPCRE 'grep -G -F -E -P pattern' ' test_expect_success LIBPCRE 'grep -G -F -E -P pattern' '
echo "ab:a+b*c" >expected && echo "d0:0" >expected &&
git grep -G -F -E -P "a\x{2b}b\x{2a}c" ab >actual && git grep -G -F -E -P "[\d]" d0 >actual &&
test_cmp expected actual test_cmp expected actual
' '
test_expect_success LIBPCRE 'grep pattern with grep.patternType=fixed, =basic, =extended, =perl' ' test_expect_success LIBPCRE 'grep pattern with grep.patternType=fixed, =basic, =extended, =perl' '
echo "ab:a+b*c" >expected && echo "d0:0" >expected &&
git \ git \
-c grep.patterntype=fixed \ -c grep.patterntype=fixed \
-c grep.patterntype=basic \ -c grep.patterntype=basic \
-c grep.patterntype=extended \ -c grep.patterntype=extended \
-c grep.patterntype=perl \ -c grep.patterntype=perl \
grep "a\x{2b}b\x{2a}c" ab >actual && grep "[\d]" d0 >actual &&
test_cmp expected actual test_cmp expected actual
' '