Message ID | patch-v3-2.7-ec8e42ced1a-20211129T143956Z-avarab@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | grep: simplify & delete "init" & "config" code | expand |
On 29.11.2021 15:50, Ævar Arnfjörð Bjarmason wrote: >Extend the tests added in my 9df46763ef1 (log: add exhaustive tests >for pattern style options & config, 2017-05-20) to check not only >whether "git log" handles "grep.patternType", but also "git show" >etc. > >It's sufficient to check whether we match a "fixed" or a "basic" regex >here to see if these codepaths correctly invoked grep_config(). We >don't need to check the details of their regular expression matching >as the "log" test does. > >Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> >--- > t/t4202-log.sh | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > >diff --git a/t/t4202-log.sh b/t/t4202-log.sh >index 7884e3d46b3..11bb25440b0 100755 >--- a/t/t4202-log.sh >+++ b/t/t4202-log.sh >@@ -449,6 +449,30 @@ test_expect_success !FAIL_PREREQS 'log with various grep.patternType configurati > ) > ' > >+for cmd in show whatchanged reflog format-patch >+do >+ case "$cmd" in >+ format-patch) myarg="HEAD~.." ;; >+ *) myarg= ;; >+ esac >+ >+ test_expect_success "$cmd: understands grep.patternType, like 'log'" ' >+ git init "pattern-type-$cmd" && >+ ( >+ cd "pattern-type-$cmd" && >+ test_commit 1 file A && >+ test_commit "(1|2)" file B 2 && >+ >+ git -c grep.patternType=fixed $cmd --grep="..." $myarg >actual && >+ test_must_be_empty actual && >+ >+ git -c grep.patternType=basic $cmd --grep="..." $myarg >actual && >+ test_file_not_empty actual >+ ) >+ ' >+done >+test_done After rebasing my work from <20220302090250.590450-1-fs@gigacodes.de> on master I was a bit confused as to why my tests in t4202 were no longer executing and none of my changes did anything about it. I suppose this `test_done` is left over from testing and slipped into master? >+ > test_expect_success 'log --author' ' > cat >expect <<-\EOF && > Author: <BOLD;RED>A U<RESET> Thor <author@example.com> >-- >2.34.1.841.gf15fb7e6f34 >
diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 7884e3d46b3..11bb25440b0 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -449,6 +449,30 @@ test_expect_success !FAIL_PREREQS 'log with various grep.patternType configurati ) ' +for cmd in show whatchanged reflog format-patch +do + case "$cmd" in + format-patch) myarg="HEAD~.." ;; + *) myarg= ;; + esac + + test_expect_success "$cmd: understands grep.patternType, like 'log'" ' + git init "pattern-type-$cmd" && + ( + cd "pattern-type-$cmd" && + test_commit 1 file A && + test_commit "(1|2)" file B 2 && + + git -c grep.patternType=fixed $cmd --grep="..." $myarg >actual && + test_must_be_empty actual && + + git -c grep.patternType=basic $cmd --grep="..." $myarg >actual && + test_file_not_empty actual + ) + ' +done +test_done + test_expect_success 'log --author' ' cat >expect <<-\EOF && Author: <BOLD;RED>A U<RESET> Thor <author@example.com>
Extend the tests added in my 9df46763ef1 (log: add exhaustive tests for pattern style options & config, 2017-05-20) to check not only whether "git log" handles "grep.patternType", but also "git show" etc. It's sufficient to check whether we match a "fixed" or a "basic" regex here to see if these codepaths correctly invoked grep_config(). We don't need to check the details of their regular expression matching as the "log" test does. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- t/t4202-log.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)