{"thread":{"id":"27477","subject":"[PATCH] git-grep: Fix problems with recently added tests","startedAt":"2011-05-26T21:50:22Z","lastAt":"2011-05-26T21:55:50Z","messageCount":2,"participants":["Michał Kiedrowicz","Brian Gernhardt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"168834","messageId":"1306446622-12784-1-git-send-email-michal.kiedrowicz@gmail.com","threadId":"27477","inReplyTo":null,"subject":"[PATCH] git-grep: Fix problems with recently added tests","fromName":"Michał Kiedrowicz","fromEmail":"michal.kiedrowicz@gmail.com","sentAt":"2011-05-26T21:50:22Z","receivedAt":"2011-05-26T21:50:22Z","isPatch":true,"sender":{"key":"michal.kiedrowicz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/14072847?v=4"},"body":"Brian Gernhardt reported that test 'git grep -E -F -G a\\\\+b' fails on\nOS X 10.6.7. This is because I assumed \\+ is part of BRE, which isn't\ntrue on all platforms.\n\nThe easiest way to make this test pass is to just update expected\noutput, but that would make the test pointless. Its real purpose is to\ncheck whether 'git grep -E -F -G' is different from 'git grep -E -G -F'.\nTo check that, let's change pattern to \"aa*b\". 'git grep -F' should\nreturn empty string and 'git grep -G' should match \"aab\".\n\nI also made two small tweaks to the tests. First, I added path \"ab\" to\nall calls to future-proof tests. Second, I updated last two tests to\nbetter show that 'git grep -P -E' is different from 'git grep -E -P'.\n\nSigned-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>\n---\n t/t7810-grep.sh |   28 ++++++++++++++--------------\n 1 files changed, 14 insertions(+), 14 deletions(-)\n\ndiff --git a/t/t7810-grep.sh b/t/t7810-grep.sh\nindex e061108..0435740 100755\n--- a/t/t7810-grep.sh\n+++ b/t/t7810-grep.sh\n@@ -234,13 +234,13 @@ do\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\tgit -c grep.extendedRegexp=false grep \"a+b\" ab >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\tgit -c grep.extendedRegexp=true grep \"a+b\" ab >actual &&\n \t\ttest_cmp expected actual\n \t'\n done\n@@ -688,37 +688,37 @@ test_expect_success LIBPCRE 'grep -P invalidpattern properly dies ' '\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+\tgit grep -F -E -G a+b ab >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+\tgit grep -F -G -E a+b ab >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+\tgit grep -E -F -G \"aa*b\" ab >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+\t:>empty &&\n+\ttest_must_fail git grep -E -G -F \"aa*b\" ab >actual &&\n+\ttest_cmp empty 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+test_expect_success 'grep -G -F -P -E pattern' '\n+\t:>empty &&\n+\ttest_must_fail git grep -G -F -P -E \"a\\x{2b}b\" ab >actual &&\n+\ttest_cmp empty actual\n '\n \n-test_expect_success LIBPCRE 'grep -E -G -F -P pattern' '\n+test_expect_success LIBPCRE 'grep -G -F -E -P pattern' '\n \techo ab:a+b >expected &&\n-\tgit grep -E -G -F -P a\\\\+b >actual &&\n+\tgit grep -G -F -E -P \"a\\x{2b}b\" ab >actual &&\n \ttest_cmp expected actual\n '\n \n-- \n1.7.3.4\n"},{"id":"168835","messageId":"A33A9CA5-B648-44AE-9B8E-7C27AB48FE54@gernhardtsoftware.com","threadId":"27477","inReplyTo":"1306446622-12784-1-git-send-email-michal.kiedrowicz@gmail.com","subject":"Re: [PATCH] git-grep: Fix problems with recently added tests","fromName":"Brian Gernhardt","fromEmail":"brian@gernhardtsoftware.com","sentAt":"2011-05-26T21:55:50Z","receivedAt":"2011-05-26T21:55:50Z","isPatch":true,"sender":{"key":"brian@gernhardtsoftware.com","avatar":"https://avatars.githubusercontent.com/u/133455?v=4"},"body":"\nOn May 26, 2011, at 5:50 PM, Michał Kiedrowicz wrote:\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> +\tgit grep -E -F -G \"aa*b\" ab >actual &&\n> \ttest_cmp expected actual\n> '\n\nWouldn't this also pass if -E was active instead of -G?  That's why I mentioned using a literal + in the pattern so that what -G and what -E would match would be different.\n\n~~ Brian\n"}]}