Skip to content

Commit

Permalink
grep -P: add tests for matching ^ and $
Browse files Browse the repository at this point in the history
Earlier, fba4f1 (grep -P: Fix matching ^ and $) fixed an ancient bug.  Add
some tests to protect the change from future breakages; a slightly broken
version of this was a part of the originally submitted patch.

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michał Kiedrowicz authored and Junio C Hamano committed Feb 27, 2012
1 parent 3ddf922 commit d29d787
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions t/t7810-grep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ test_expect_success setup '
echo vvv >t/v &&
mkdir t/a &&
echo vvv >t/a/v &&
{
echo "line without leading space1"
echo " line with leading space1"
echo " line with leading space2"
echo " line with leading space3"
echo "line without leading space2"
} >space &&
git add . &&
test_tick &&
git commit -m initial
Expand Down Expand Up @@ -893,4 +900,20 @@ test_expect_success 'mimic ack-grep --group' '
test_cmp expected actual
'

cat >expected <<EOF
space: line with leading space1
space: line with leading space2
space: line with leading space3
EOF

test_expect_success LIBPCRE 'grep -E "^ "' '
git grep -E "^ " space >actual &&
test_cmp expected actual
'

test_expect_success LIBPCRE 'grep -P "^ "' '
git grep -P "^ " space >actual &&
test_cmp expected actual
'

test_done

0 comments on commit d29d787

Please sign in to comment.