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 <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Mar 22, 2014 at 18:15 UTC
e7880fcd41dd4424a79efb0a939f1c008c5519c0
1 file changed
+14
-12
t/t4209-log-pickaxe.sh
+14
-12
@@ -33,6 +33,12 @@ test_log () {
33
"
34
}
35
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
+
42
test_expect_success setup '
43
>expect_nomatch &&
44
@@ -74,12 +80,10 @@ test_expect_success 'log --author -i' '
80
test_cmp expect_second actual
81
'
82
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
87
88
test_expect_success 'log -G --textconv (missing textconv tool)' '
89
echo "* diff=test" >.gitattributes &&
@@ -94,12 +98,10 @@ test_expect_success 'log -G --no-textconv (missing textconv tool)' '
98
rm .gitattributes
99
'
100
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
105
106
test_expect_success 'log -S --textconv (missing textconv tool)' '
107
echo "* diff=test" >.gitattributes &&