3 # Copyright (c) 2005 Junio C Hamano
6 test_description
='git mailinfo and git mailsplit test'
10 test_expect_success
'split sample box' \
11 'git mailsplit -o. "$TEST_DIRECTORY"/t5100/sample.mbox >last &&
13 echo total is $last &&
16 for mail in `echo 00*`
18 test_expect_success
"mailinfo $mail" '
19 git mailinfo -u msg$mail patch$mail <$mail >info$mail &&
21 test_cmp "$TEST_DIRECTORY"/t5100/msg$mail msg$mail &&
23 test_cmp "$TEST_DIRECTORY"/t5100/patch$mail patch$mail &&
25 test_cmp "$TEST_DIRECTORY"/t5100/info$mail info$mail
29 test_expect_success
'respect NULs' '
31 git mailsplit -d3 -o. "$TEST_DIRECTORY"/t5100/nul-plain &&
32 test_cmp "$TEST_DIRECTORY"/t5100/nul-plain 001 &&
33 (cat 001 | git mailinfo msg patch) &&
34 test 4 = $(wc -l < patch)
38 test_expect_success
'Preserve NULs out of MIME encoded message' '
40 git mailsplit -d5 -o. "$TEST_DIRECTORY"/t5100/nul-b64.in &&
41 test_cmp "$TEST_DIRECTORY"/t5100/nul-b64.in 00001 &&
42 git mailinfo msg patch <00001 &&
43 test_cmp "$TEST_DIRECTORY"/t5100/nul-b64.expect patch
47 test_expect_success
'mailinfo on from header without name works' '
50 git mailsplit -oinfo-from "$TEST_DIRECTORY"/t5100/info-from.in &&
51 test_cmp "$TEST_DIRECTORY"/t5100/info-from.in info-from/0001 &&
52 git mailinfo info-from/msg info-from/patch \
53 <info-from/0001 >info-from/out &&
54 test_cmp "$TEST_DIRECTORY"/t5100/info-from.expect info-from/out