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 &&
19 git mailinfo
-u $opt msg
$mo patch$mo <$mail >info
$mo &&
20 test_cmp
"$TEST_DIRECTORY"/t5100
/msg
$mo msg
$mo &&
21 test_cmp
"$TEST_DIRECTORY"/t5100
/patch$mo patch$mo &&
22 test_cmp
"$TEST_DIRECTORY"/t5100
/info
$mo info
$mo
26 for mail in `echo 00*`
28 test_expect_success
"mailinfo $mail" '
29 check_mailinfo $mail "" &&
30 if test -f "$TEST_DIRECTORY"/t5100/msg$mail--scissors
32 check_mailinfo $mail --scissors
34 if test -f "$TEST_DIRECTORY"/t5100/msg$mail--no-inbody-headers
36 check_mailinfo $mail --no-inbody-headers
38 if test -f "$TEST_DIRECTORY"/t5100/msg$mail--message-id
40 check_mailinfo $mail --message-id
46 test_expect_success
'split box with rfc2047 samples' \
48 git mailsplit -orfc2047 "$TEST_DIRECTORY"/t5100/rfc2047-samples.mbox \
50 last=`cat rfc2047/last` &&
51 echo total is $last &&
52 test `cat rfc2047/last` = 11'
54 for mail in `echo rfc2047/00*`
56 test_expect_success ICONV
"mailinfo $mail" '
57 git mailinfo -u $mail-msg $mail-patch <$mail >$mail-info &&
59 test_cmp "$TEST_DIRECTORY"/t5100/empty $mail-msg &&
61 test_cmp "$TEST_DIRECTORY"/t5100/empty $mail-patch &&
63 test_cmp "$TEST_DIRECTORY"/t5100/rfc2047-info-$(basename $mail) $mail-info
67 test_expect_success
'respect NULs' '
69 git mailsplit -d3 -o. "$TEST_DIRECTORY"/t5100/nul-plain &&
70 test_cmp "$TEST_DIRECTORY"/t5100/nul-plain 001 &&
71 (cat 001 | git mailinfo msg patch) &&
72 test_line_count = 4 patch
76 test_expect_success
'Preserve NULs out of MIME encoded message' '
78 git mailsplit -d5 -o. "$TEST_DIRECTORY"/t5100/nul-b64.in &&
79 test_cmp "$TEST_DIRECTORY"/t5100/nul-b64.in 00001 &&
80 git mailinfo msg patch <00001 &&
81 test_cmp "$TEST_DIRECTORY"/t5100/nul-b64.expect patch
85 test_expect_success
'mailinfo on from header without name works' '
88 git mailsplit -oinfo-from "$TEST_DIRECTORY"/t5100/info-from.in &&
89 test_cmp "$TEST_DIRECTORY"/t5100/info-from.in info-from/0001 &&
90 git mailinfo info-from/msg info-from/patch \
91 <info-from/0001 >info-from/out &&
92 test_cmp "$TEST_DIRECTORY"/t5100/info-from.expect info-from/out
96 test_expect_success
'mailinfo finds headers after embedded From line' '
98 git mailsplit -oembed-from "$TEST_DIRECTORY"/t5100/embed-from.in &&
99 test_cmp "$TEST_DIRECTORY"/t5100/embed-from.in embed-from/0001 &&
100 git mailinfo embed-from/msg embed-from/patch \
101 <embed-from/0001 >embed-from/out &&
102 test_cmp "$TEST_DIRECTORY"/t5100/embed-from.expect embed-from/out
105 test_expect_success
'mailinfo on message with quoted >From' '
107 git mailsplit -oquoted-from "$TEST_DIRECTORY"/t5100/quoted-from.in &&
108 test_cmp "$TEST_DIRECTORY"/t5100/quoted-from.in quoted-from/0001 &&
109 git mailinfo quoted-from/msg quoted-from/patch \
110 <quoted-from/0001 >quoted-from/out &&
111 test_cmp "$TEST_DIRECTORY"/t5100/quoted-from.expect quoted-from/msg