1#!/bin/sh2#3# Copyright (c) 2005 Junio C Hamano4#56test_description='git mailinfo and git mailsplit test'78. ./test-lib.sh910test_expect_success 'split sample box' \11'git mailsplit -o. ../t5100/sample.mbox >last &&12last=`cat last` &&13echo total is $last &&14test `cat last` = 13'1516for mail in `echo 00*`17do18test_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"26done272829test_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'3637for mail in `echo rfc2047/00*`38do39test_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-info47'48done4950test_expect_success 'respect NULs' '5152git mailsplit -d3 -o. ../t5100/nul-plain &&53cmp ../t5100/nul-plain 001 &&54(cat 001 | git mailinfo msg patch) &&55test 4 = $(wc -l < patch)5657'5859test_expect_success 'Preserve NULs out of MIME encoded message' '6061git mailsplit -d5 -o. ../t5100/nul-b64.in &&62cmp ../t5100/nul-b64.in 00001 &&63git mailinfo msg patch <00001 &&64cmp ../t5100/nul-b64.expect patch6566'6768test_expect_success 'mailinfo on from header without name works' '6970mkdir 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/out7677'7879test_done