{"thread":{"id":"27425","subject":"[PATCH] git-grep: Update tests (mainly for -P)","startedAt":"2011-05-22T11:37:28Z","lastAt":"2011-05-23T18:57:04Z","messageCount":2,"participants":["Michał Kiedrowicz","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"168445","messageId":"1306064248-23092-1-git-send-email-michal.kiedrowicz@gmail.com","threadId":"27425","inReplyTo":null,"subject":"[PATCH] git-grep: Update tests (mainly for -P)","fromName":"Michał Kiedrowicz","fromEmail":"michal.kiedrowicz@gmail.com","sentAt":"2011-05-22T11:37:28Z","receivedAt":"2011-05-22T11:37:28Z","isPatch":true,"sender":{"key":"michal.kiedrowicz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/14072847?v=4"},"body":"This patch adds few more tests to git-grep concerning the\n-P/--perl-regexp option.\n\nWhile at it, add some generic tests for grep.extendedRegexp config\noption, for detecting invalid regexep and check if \"last one wins\" rule\nworks for selecting regexp type.\n\nSigned-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>\n---\nThis is the promised update to tests and is meant to be applied on top of\nmk/grep-pcre.\n\n t/t7810-grep.sh |   85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 85 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t7810-grep.sh b/t/t7810-grep.sh\nindex e845218..e061108 100755\n--- a/t/t7810-grep.sh\n+++ b/t/t7810-grep.sh\n@@ -32,6 +32,11 @@ test_expect_success setup '\n \t\techo Hello_world\n \t\techo HeLLo_world\n \t} >hello_world &&\n+\t{\n+\t\techo aab\n+\t\techo a+b\n+\t\techo a\\\\+b\n+\t} >ab &&\n \techo vvv >v &&\n \techo ww w >w &&\n \techo x x xx x >x &&\n@@ -227,7 +232,17 @@ do\n \t\tgit grep --max-depth 0 -n -e vvv $H -- t . >actual &&\n \t\ttest_cmp expected actual\n \t'\n+\ttest_expect_success \"grep $L with grep.extendedRegexp=false\" '\n+\t\techo \"ab:a+b\" >expected &&\n+\t\tgit -c grep.extendedRegexp=false grep \"a+b\" >actual &&\n+\t\ttest_cmp expected actual\n+\t'\n \n+\ttest_expect_success \"grep $L with grep.extendedRegexp=true\" '\n+\t\techo \"ab:aab\" >expected &&\n+\t\tgit -c grep.extendedRegexp=true grep \"a+b\" >actual &&\n+\t\ttest_cmp expected actual\n+\t'\n done\n \n cat >expected <<EOF\n@@ -620,6 +635,28 @@ test_expect_success LIBPCRE 'grep -P pattern' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'grep pattern with grep.extendedRegexp=true' '\n+\t:>empty &&\n+\ttest_must_fail git -c grep.extendedregexp=true \\\n+\t\tgrep \"\\p{Ps}.*?\\p{Pe}\" hello.c >actual &&\n+\ttest_cmp empty actual\n+'\n+\n+test_expect_success LIBPCRE 'grep -P pattern with grep.extendedRegexp=true' '\n+\tgit -c grep.extendedregexp=true \\\n+\t\tgrep -P \"\\p{Ps}.*?\\p{Pe}\" hello.c >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success LIBPCRE 'grep -P -v pattern' '\n+\t{\n+\t\techo ab:a+b\n+\t\techo ab:a\\\\+b\n+\t} >expected &&\n+\tgit grep -P -v \"aab\" ab >actual &&\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success LIBPCRE 'grep -P -i pattern' '\n \t{\n \t\techo \"hello.c:\tprintf(\\\"Hello world.\\n\\\");\"\n@@ -637,4 +674,52 @@ test_expect_success LIBPCRE 'grep -P -w pattern' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'grep -G invalidpattern properly dies ' '\n+\ttest_must_fail git grep -G \"a[\"\n+'\n+\n+test_expect_success 'grep -E invalidpattern properly dies ' '\n+\ttest_must_fail git grep -E \"a[\"\n+'\n+\n+test_expect_success LIBPCRE 'grep -P invalidpattern properly dies ' '\n+\ttest_must_fail git grep -P \"a[\"\n+'\n+\n+test_expect_success 'grep -F -E -G pattern' '\n+\techo ab:a+b >expected &&\n+\tgit grep -F -E -G a+b >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success 'grep -F -G -E pattern' '\n+\techo ab:aab >expected &&\n+\tgit grep -F -G -E a+b >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success 'grep -E -F -G pattern' '\n+\techo ab:aab >expected &&\n+\tgit grep -E -F -G a\\\\+b >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success 'grep -E -G -F pattern' '\n+\techo ab:a\\\\+b >expected &&\n+\tgit grep -E -G -F a\\\\+b >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success 'grep -G -F -E pattern' '\n+\techo ab:a+b >expected &&\n+\tgit grep -G -F -E a\\\\+b >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success LIBPCRE 'grep -E -G -F -P pattern' '\n+\techo ab:a+b >expected &&\n+\tgit grep -E -G -F -P a\\\\+b >actual &&\n+\ttest_cmp expected actual\n+'\n+\n test_done\n-- \n1.7.3.4\n"},{"id":"168544","messageId":"7vei3pt3yj.fsf@alter.siamese.dyndns.org","threadId":"27425","inReplyTo":"1306064248-23092-1-git-send-email-michal.kiedrowicz@gmail.com","subject":"Re: [PATCH] git-grep: Update tests (mainly for -P)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-05-23T18:57:04Z","receivedAt":"2011-05-23T18:57:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michał Kiedrowicz <michal.kiedrowicz@gmail.com> writes:\n\n> This patch adds few more tests to git-grep concerning the\n> -P/--perl-regexp option.\n>\n> While at it, add some generic tests for grep.extendedRegexp config\n> option, for detecting invalid regexep and check if \"last one wins\" rule\n> works for selecting regexp type.\n>\n> Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>\n> ---\n> This is the promised update to tests and is meant to be applied on top of\n> mk/grep-pcre.\n\nThanks, will queue.\n\n>  t/t7810-grep.sh |   85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>  1 files changed, 85 insertions(+), 0 deletions(-)\n>\n> diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh\n> index e845218..e061108 100755\n> --- a/t/t7810-grep.sh\n> +++ b/t/t7810-grep.sh\n> @@ -32,6 +32,11 @@ test_expect_success setup '\n>  \t\techo Hello_world\n>  \t\techo HeLLo_world\n>  \t} >hello_world &&\n> +\t{\n> +\t\techo aab\n> +\t\techo a+b\n> +\t\techo a\\\\+b\n> +\t} >ab &&\n\nAt some point it would be a good idea to clean these up to use either\ncascading && or\n\n\tcat >ab <<\\-EOF &&\n        ...\n        EOF\n\neverywhere.\n"}]}