apply --whitespace: warn blank but not necessarily empty lines at EOF
[gitweb.git] / t / t5100-mailinfo.sh
index a8b78ebf7d021cb626d4452545b5f4d1e0efe34f..b851b3a1758ee2efd62aee86c988024b10cb3e7b 100755 (executable)
@@ -11,7 +11,7 @@ test_expect_success 'split sample box' \
        'git mailsplit -o. ../t5100/sample.mbox >last &&
        last=`cat last` &&
        echo total is $last &&
-       test `cat last` = 9'
+       test `cat last` = 13'
 
 for mail in `echo 00*`
 do
@@ -25,10 +25,32 @@ do
                diff ../t5100/info$mail info$mail"
 done
 
+
+test_expect_success 'split box with rfc2047 samples' \
+       'mkdir rfc2047 &&
+       git mailsplit -orfc2047 "$TEST_DIRECTORY"/t5100/rfc2047-samples.mbox \
+         >rfc2047/last &&
+       last=`cat rfc2047/last` &&
+       echo total is $last &&
+       test `cat rfc2047/last` = 11'
+
+for mail in `echo rfc2047/00*`
+do
+       test_expect_success "mailinfo $mail" '
+               git mailinfo -u $mail-msg $mail-patch <$mail >$mail-info &&
+               echo msg &&
+               test_cmp "$TEST_DIRECTORY"/t5100/empty $mail-msg &&
+               echo patch &&
+               test_cmp "$TEST_DIRECTORY"/t5100/empty $mail-patch &&
+               echo info &&
+               test_cmp "$TEST_DIRECTORY"/t5100/rfc2047-info-$(basename $mail) $mail-info
+       '
+done
+
 test_expect_success 'respect NULs' '
 
-       git mailsplit -d3 -o. ../t5100/nul &&
-       cmp ../t5100/nul 001 &&
+       git mailsplit -d3 -o. ../t5100/nul-plain &&
+       cmp ../t5100/nul-plain 001 &&
        (cat 001 | git mailinfo msg patch) &&
        test 4 = $(wc -l < patch)
 
@@ -43,4 +65,15 @@ test_expect_success 'Preserve NULs out of MIME encoded message' '
 
 '
 
+test_expect_success 'mailinfo on from header without name works' '
+
+       mkdir info-from &&
+       git mailsplit -oinfo-from "$TEST_DIRECTORY"/t5100/info-from.in &&
+       test_cmp "$TEST_DIRECTORY"/t5100/info-from.in info-from/0001 &&
+       git mailinfo info-from/msg info-from/patch \
+         <info-from/0001 >info-from/out &&
+       test_cmp "$TEST_DIRECTORY"/t5100/info-from.expect info-from/out
+
+'
+
 test_done