Merge branch 'km/test-mailinfo-b-failure' into maint
authorJunio C Hamano <gitster@pobox.com>
Sat, 24 Jun 2017 22:29:33 +0000 (15:29 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 24 Jun 2017 22:29:33 +0000 (15:29 -0700)
New tests.

* km/test-mailinfo-b-failure:
  t5100: add some more mailinfo tests

1  2 
t/t5100-mailinfo.sh

@@@ -158,17 -158,46 +158,59 @@@ test_expect_success 'mailinfo handles r
        test_cmp "$DATA/comment.expect" comment/info
  '
  
 +test_expect_success 'mailinfo with mailinfo.scissors config' '
 +      test_config mailinfo.scissors true &&
 +      (
 +              mkdir sub &&
 +              cd sub &&
 +              git mailinfo ../msg0014.sc ../patch0014.sc <../0014 >../info0014.sc
 +      ) &&
 +      test_cmp "$DATA/msg0014--scissors" msg0014.sc &&
 +      test_cmp "$DATA/patch0014--scissors" patch0014.sc &&
 +      test_cmp "$DATA/info0014--scissors" info0014.sc
 +'
 +
 +
+ test_expect_success 'mailinfo no options' '
+       subj="$(echo "Subject: [PATCH] [other] [PATCH] message" |
+               git mailinfo /dev/null /dev/null)" &&
+       test z"$subj" = z"Subject: message"
+ '
+ test_expect_success 'mailinfo -k' '
+       subj="$(echo "Subject: [PATCH] [other] [PATCH] message" |
+               git mailinfo -k /dev/null /dev/null)" &&
+       test z"$subj" = z"Subject: [PATCH] [other] [PATCH] message"
+ '
+ test_expect_success 'mailinfo -b no [PATCH]' '
+       subj="$(echo "Subject: [other] message" |
+               git mailinfo -b /dev/null /dev/null)" &&
+       test z"$subj" = z"Subject: [other] message"
+ '
+ test_expect_success 'mailinfo -b leading [PATCH]' '
+       subj="$(echo "Subject: [PATCH] [other] message" |
+               git mailinfo -b /dev/null /dev/null)" &&
+       test z"$subj" = z"Subject: [other] message"
+ '
+ test_expect_success 'mailinfo -b double [PATCH]' '
+       subj="$(echo "Subject: [PATCH] [PATCH] message" |
+               git mailinfo -b /dev/null /dev/null)" &&
+       test z"$subj" = z"Subject: message"
+ '
+ test_expect_failure 'mailinfo -b trailing [PATCH]' '
+       subj="$(echo "Subject: [other] [PATCH] message" |
+               git mailinfo -b /dev/null /dev/null)" &&
+       test z"$subj" = z"Subject: [other] message"
+ '
+ test_expect_failure 'mailinfo -b separated double [PATCH]' '
+       subj="$(echo "Subject: [PATCH] [other] [PATCH] message" |
+               git mailinfo -b /dev/null /dev/null)" &&
+       test z"$subj" = z"Subject: [other] message"
+ '
  test_done