t5100: add some more mailinfo tests

Add some more simple mailinfo tests including a few that produce: fatal: `pos + len' is too far after the end of the buffer Mark those as 'test_expect_failure'. Signed-off-by: Kyle J. McKay <mackyle@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Kyle J. McKay committed May 31, 2017 at 03:26 UTC ae52d57f0b45b2db93f13c009b7a31108d5d6525
1 file changed +42
t/t5100-mailinfo.sh
+42
@@ -158,4 +158,46 @@ test_expect_success 'mailinfo handles rfc2822 comment' '
158 test_cmp "$DATA/comment.expect" comment/info
159 '
160
161 +test_expect_success 'mailinfo no options' '
162 + subj="$(echo "Subject: [PATCH] [other] [PATCH] message" |
163 + git mailinfo /dev/null /dev/null)" &&
164 + test z"$subj" = z"Subject: message"
165 +'
166 +
167 +test_expect_success 'mailinfo -k' '
168 + subj="$(echo "Subject: [PATCH] [other] [PATCH] message" |
169 + git mailinfo -k /dev/null /dev/null)" &&
170 + test z"$subj" = z"Subject: [PATCH] [other] [PATCH] message"
171 +'
172 +
173 +test_expect_success 'mailinfo -b no [PATCH]' '
174 + subj="$(echo "Subject: [other] message" |
175 + git mailinfo -b /dev/null /dev/null)" &&
176 + test z"$subj" = z"Subject: [other] message"
177 +'
178 +
179 +test_expect_success 'mailinfo -b leading [PATCH]' '
180 + subj="$(echo "Subject: [PATCH] [other] message" |
181 + git mailinfo -b /dev/null /dev/null)" &&
182 + test z"$subj" = z"Subject: [other] message"
183 +'
184 +
185 +test_expect_success 'mailinfo -b double [PATCH]' '
186 + subj="$(echo "Subject: [PATCH] [PATCH] message" |
187 + git mailinfo -b /dev/null /dev/null)" &&
188 + test z"$subj" = z"Subject: message"
189 +'
190 +
191 +test_expect_failure 'mailinfo -b trailing [PATCH]' '
192 + subj="$(echo "Subject: [other] [PATCH] message" |
193 + git mailinfo -b /dev/null /dev/null)" &&
194 + test z"$subj" = z"Subject: [other] message"
195 +'
196 +
197 +test_expect_failure 'mailinfo -b separated double [PATCH]' '
198 + subj="$(echo "Subject: [PATCH] [other] [PATCH] message" |
199 + git mailinfo -b /dev/null /dev/null)" &&
200 + test z"$subj" = z"Subject: [other] message"
201 +'
202 +
203 test_done