]>
Commit | Line | Data |
---|---|---|
4839c0b5 JH |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2005 Junio C Hamano | |
4 | # | |
5 | ||
5be60078 | 6 | test_description='git mailinfo and git mailsplit test' |
4839c0b5 JH |
7 | |
8 | . ./test-lib.sh | |
9 | ||
10 | test_expect_success 'split sample box' \ | |
bfdbee98 | 11 | 'git mailsplit -o. "$TEST_DIRECTORY"/t5100/sample.mbox >last && |
4839c0b5 JH |
12 | last=`cat last` && |
13 | echo total is $last && | |
176943b9 | 14 | test `cat last` = 17' |
4839c0b5 | 15 | |
017678b4 JH |
16 | check_mailinfo () { |
17 | mail=$1 opt=$2 | |
18 | mo="$mail$opt" | |
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 | |
23 | } | |
24 | ||
25 | ||
4839c0b5 JH |
26 | for mail in `echo 00*` |
27 | do | |
bfdbee98 | 28 | test_expect_success "mailinfo $mail" ' |
017678b4 JH |
29 | check_mailinfo $mail "" && |
30 | if test -f "$TEST_DIRECTORY"/t5100/msg$mail--scissors | |
31 | then | |
32 | check_mailinfo $mail --scissors | |
d25e5159 LS |
33 | fi && |
34 | if test -f "$TEST_DIRECTORY"/t5100/msg$mail--no-inbody-headers | |
35 | then | |
36 | check_mailinfo $mail --no-inbody-headers | |
017678b4 | 37 | fi |
bfdbee98 | 38 | ' |
4839c0b5 JH |
39 | done |
40 | ||
c32815f9 KS |
41 | |
42 | test_expect_success 'split box with rfc2047 samples' \ | |
43 | 'mkdir rfc2047 && | |
44 | git mailsplit -orfc2047 "$TEST_DIRECTORY"/t5100/rfc2047-samples.mbox \ | |
45 | >rfc2047/last && | |
46 | last=`cat rfc2047/last` && | |
47 | echo total is $last && | |
48 | test `cat rfc2047/last` = 11' | |
49 | ||
50 | for mail in `echo rfc2047/00*` | |
51 | do | |
52 | test_expect_success "mailinfo $mail" ' | |
53 | git mailinfo -u $mail-msg $mail-patch <$mail >$mail-info && | |
54 | echo msg && | |
55 | test_cmp "$TEST_DIRECTORY"/t5100/empty $mail-msg && | |
56 | echo patch && | |
57 | test_cmp "$TEST_DIRECTORY"/t5100/empty $mail-patch && | |
58 | echo info && | |
59 | test_cmp "$TEST_DIRECTORY"/t5100/rfc2047-info-$(basename $mail) $mail-info | |
60 | ' | |
61 | done | |
62 | ||
cce8d6fd JS |
63 | test_expect_success 'respect NULs' ' |
64 | ||
bfdbee98 JH |
65 | git mailsplit -d3 -o. "$TEST_DIRECTORY"/t5100/nul-plain && |
66 | test_cmp "$TEST_DIRECTORY"/t5100/nul-plain 001 && | |
cce8d6fd | 67 | (cat 001 | git mailinfo msg patch) && |
3fb0459b | 68 | test_line_count = 4 patch |
cce8d6fd JS |
69 | |
70 | ' | |
71 | ||
9aa23094 JH |
72 | test_expect_success 'Preserve NULs out of MIME encoded message' ' |
73 | ||
bfdbee98 JH |
74 | git mailsplit -d5 -o. "$TEST_DIRECTORY"/t5100/nul-b64.in && |
75 | test_cmp "$TEST_DIRECTORY"/t5100/nul-b64.in 00001 && | |
9aa23094 | 76 | git mailinfo msg patch <00001 && |
bfdbee98 | 77 | test_cmp "$TEST_DIRECTORY"/t5100/nul-b64.expect patch |
9aa23094 JH |
78 | |
79 | ' | |
80 | ||
e9d7d10a JK |
81 | test_expect_success 'mailinfo on from header without name works' ' |
82 | ||
83 | mkdir info-from && | |
84 | git mailsplit -oinfo-from "$TEST_DIRECTORY"/t5100/info-from.in && | |
85 | test_cmp "$TEST_DIRECTORY"/t5100/info-from.in info-from/0001 && | |
86 | git mailinfo info-from/msg info-from/patch \ | |
87 | <info-from/0001 >info-from/out && | |
88 | test_cmp "$TEST_DIRECTORY"/t5100/info-from.expect info-from/out | |
89 | ||
90 | ' | |
91 | ||
4839c0b5 | 92 | test_done |