1#!/bin/sh
2#
3# Copyright (c) 2005 Junio C Hamano
4#
56
test_description='git mailinfo and git mailsplit test'
78
. ./test-lib.sh
910
test_expect_success 'split sample box' \
11'git mailsplit -o. ../t5100/sample.mbox >last &&
12last=`cat last` &&
13echo total is $last &&
14test `cat last` = 13'
1516
for mail in `echo 00*`
17do
18test_expect_success "mailinfo $mail" \
19"git mailinfo -u msg$mail patch$mail <$mail >info$mail &&
20echo msg &&
21diff ../t5100/msg$mail msg$mail &&
22echo patch &&
23diff ../t5100/patch$mail patch$mail &&
24echo info &&
25diff ../t5100/info$mail info$mail"
26done
2728
29
test_expect_success 'split box with rfc2047 samples' \
30'mkdir rfc2047 &&
31git mailsplit -orfc2047 "$TEST_DIRECTORY"/t5100/rfc2047-samples.mbox \
32>rfc2047/last &&
33last=`cat rfc2047/last` &&
34echo total is $last &&
35test `cat rfc2047/last` = 11'
3637
for mail in `echo rfc2047/00*`
38do
39test_expect_success "mailinfo $mail" '
40git mailinfo -u $mail-msg $mail-patch <$mail >$mail-info &&
41echo msg &&
42test_cmp "$TEST_DIRECTORY"/t5100/empty $mail-msg &&
43echo patch &&
44test_cmp "$TEST_DIRECTORY"/t5100/empty $mail-patch &&
45echo info &&
46test_cmp "$TEST_DIRECTORY"/t5100/rfc2047-info-$(basename $mail) $mail-info
47'
48done
4950
test_expect_success 'respect NULs' '
5152
git mailsplit -d3 -o. ../t5100/nul-plain &&
53cmp ../t5100/nul-plain 001 &&
54(cat 001 | git mailinfo msg patch) &&
55test 4 = $(wc -l < patch)
5657
'
5859
test_expect_success 'Preserve NULs out of MIME encoded message' '
6061
git mailsplit -d5 -o. ../t5100/nul-b64.in &&
62cmp ../t5100/nul-b64.in 00001 &&
63git mailinfo msg patch <00001 &&
64cmp ../t5100/nul-b64.expect patch
6566
'
6768
test_expect_success 'mailinfo on from header without name works' '
6970
mkdir info-from &&
71git mailsplit -oinfo-from "$TEST_DIRECTORY"/t5100/info-from.in &&
72test_cmp "$TEST_DIRECTORY"/t5100/info-from.in info-from/0001 &&
73git mailinfo info-from/msg info-from/patch \
74<info-from/0001 >info-from/out &&
75test_cmp "$TEST_DIRECTORY"/t5100/info-from.expect info-from/out
7677
'
7879
test_done