{"thread":{"id":"27478","subject":"[PATCH] git-grep: Fix problems with recently added tests","startedAt":"2011-05-26T22:43:59Z","lastAt":"2011-05-26T22:43:59Z","messageCount":1,"participants":["Michał Kiedrowicz"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"168843","messageId":"1306449839-7491-1-git-send-email-michal.kiedrowicz@gmail.com","threadId":"27478","inReplyTo":"7vvcwxunbt.fsf@alter.siamese.dyndns.org","subject":"[PATCH] git-grep: Fix problems with recently added tests","fromName":"Michał Kiedrowicz","fromEmail":"michal.kiedrowicz@gmail.com","sentAt":"2011-05-26T22:43:59Z","receivedAt":"2011-05-26T22:43:59Z","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 \"a+b*c\". This should return\ndifferent match for -G, -F and -E.\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 |   56 ++++++++++++++++++++++++------------------------------\n 1 files changed, 25 insertions(+), 31 deletions(-)\n\ndiff --git a/t/t7810-grep.sh b/t/t7810-grep.sh\nindex e061108..e1d8c40 100755\n--- a/t/t7810-grep.sh\n+++ b/t/t7810-grep.sh\n@@ -33,9 +33,9 @@ test_expect_success setup '\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\techo \"a+b*c\"\n+\t\techo \"a+bc\"\n+\t\techo \"abc\"\n \t} >ab &&\n \techo vvv >v &&\n \techo ww w >w &&\n@@ -233,14 +233,14 @@ do\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\techo \"ab:a+bc\" >expected &&\n+\t\tgit -c grep.extendedRegexp=false grep \"a+b*c\" 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\techo \"ab:abc\" >expected &&\n+\t\tgit -c grep.extendedRegexp=true grep \"a+b*c\" ab >actual &&\n \t\ttest_cmp expected actual\n \t'\n done\n@@ -650,10 +650,10 @@ test_expect_success LIBPCRE 'grep -P pattern with grep.extendedRegexp=true' '\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\techo \"ab:a+b*c\"\n+\t\techo \"ab:a+bc\"\n \t} >expected &&\n-\tgit grep -P -v \"aab\" ab >actual &&\n+\tgit grep -P -v \"abc\" ab >actual &&\n \ttest_cmp expected actual\n '\n \n@@ -686,39 +686,33 @@ 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+test_expect_success 'grep -G -E -F pattern' '\n+\techo \"ab:a+b*c\" >expected &&\n+\tgit grep -G -E -F \"a+b*c\" 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+\techo \"ab:a+bc\" >expected &&\n+\tgit grep -E -F -G \"a+b*c\" 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+test_expect_success 'grep -F -G -E pattern' '\n+\techo \"ab:abc\" >expected &&\n+\tgit grep -F -G -E \"a+b*c\" ab >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+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\\x{2a}c\" ab >actual &&\n+\ttest_cmp empty 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+test_expect_success LIBPCRE 'grep -G -F -E -P pattern' '\n+\techo \"ab:a+b*c\" >expected &&\n+\tgit grep -G -F -E -P \"a\\x{2b}b\\x{2a}c\" ab >actual &&\n \ttest_cmp expected actual\n '\n \n-- \n1.7.3.4\n"}]}