Skip to content

Commit e7880fc

Browse files
rscharfegitster
authored andcommitted
t4209: factor out helper function test_log_icase()
Reduce code duplication by introducing test_log_icase() that runs the same test with both --regexp-ignore-case and -i. The specification of the four basic test scenarios (matching/nomatching combined with case sensitive/insensitive) becomes easier to read and write. Signed-off-by: Rene Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 57b6dc7 commit e7880fc

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

t/t4209-log-pickaxe.sh

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ test_log () {
3333
"
3434
}
3535

36+
# test -i and --regexp-ignore-case and expect both to behave the same way
37+
test_log_icase () {
38+
test_log $@ --regexp-ignore-case
39+
test_log $@ -i
40+
}
41+
3642
test_expect_success setup '
3743
>expect_nomatch &&
3844
@@ -74,12 +80,10 @@ test_expect_success 'log --author -i' '
7480
test_cmp expect_second actual
7581
'
7682

77-
test_log expect_nomatch -G picked
78-
test_log expect_second -G Picked
79-
test_log expect_nomatch -G pickle --regexp-ignore-case
80-
test_log expect_nomatch -G pickle -i
81-
test_log expect_second -G picked --regexp-ignore-case
82-
test_log expect_second -G picked -i
83+
test_log expect_nomatch -G picked
84+
test_log expect_second -G Picked
85+
test_log_icase expect_nomatch -G pickle
86+
test_log_icase expect_second -G picked
8387

8488
test_expect_success 'log -G --textconv (missing textconv tool)' '
8589
echo "* diff=test" >.gitattributes &&
@@ -94,12 +98,10 @@ test_expect_success 'log -G --no-textconv (missing textconv tool)' '
9498
rm .gitattributes
9599
'
96100

97-
test_log expect_nomatch -S picked
98-
test_log expect_second -S Picked
99-
test_log expect_second -S picked --regexp-ignore-case
100-
test_log expect_second -S picked -i
101-
test_log expect_nomatch -S pickle --regexp-ignore-case
102-
test_log expect_nomatch -S pickle -i
101+
test_log expect_nomatch -S picked
102+
test_log expect_second -S Picked
103+
test_log_icase expect_second -S picked
104+
test_log_icase expect_nomatch -S pickle
103105

104106
test_expect_success 'log -S --textconv (missing textconv tool)' '
105107
echo "* diff=test" >.gitattributes &&

0 commit comments

Comments
 (0)