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. "$TEST_DIRECTORY"/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" '19git mailinfo -u msg$mail patch$mail <$mail >info$mail &&20echo msg &&21test_cmp "$TEST_DIRECTORY"/t5100/msg$mail msg$mail &&22echo patch &&23test_cmp "$TEST_DIRECTORY"/t5100/patch$mail patch$mail &&24echo info &&25test_cmp "$TEST_DIRECTORY"/t5100/info$mail info$mail26'27done282930test_expect_success 'split box with rfc2047 samples' \31'mkdir rfc2047 &&32git mailsplit -orfc2047 "$TEST_DIRECTORY"/t5100/rfc2047-samples.mbox \33>rfc2047/last &&34last=`cat rfc2047/last` &&35echo total is $last &&36test `cat rfc2047/last` = 11'3738for mail in `echo rfc2047/00*`39do40test_expect_success "mailinfo $mail" '41git mailinfo -u $mail-msg $mail-patch <$mail >$mail-info &&42echo msg &&43test_cmp "$TEST_DIRECTORY"/t5100/empty $mail-msg &&44echo patch &&45test_cmp "$TEST_DIRECTORY"/t5100/empty $mail-patch &&46echo info &&47test_cmp "$TEST_DIRECTORY"/t5100/rfc2047-info-$(basename $mail) $mail-info48'49done5051test_expect_success 'respect NULs' '5253git mailsplit -d3 -o. "$TEST_DIRECTORY"/t5100/nul-plain &&54test_cmp "$TEST_DIRECTORY"/t5100/nul-plain 001 &&55(cat 001 | git mailinfo msg patch) &&56test 4 = $(wc -l < patch)5758'5960test_expect_success 'Preserve NULs out of MIME encoded message' '6162git mailsplit -d5 -o. "$TEST_DIRECTORY"/t5100/nul-b64.in &&63test_cmp "$TEST_DIRECTORY"/t5100/nul-b64.in 00001 &&64git mailinfo msg patch <00001 &&65test_cmp "$TEST_DIRECTORY"/t5100/nul-b64.expect patch6667'6869test_expect_success 'mailinfo on from header without name works' '7071mkdir info-from &&72git mailsplit -oinfo-from "$TEST_DIRECTORY"/t5100/info-from.in &&73test_cmp "$TEST_DIRECTORY"/t5100/info-from.in info-from/0001 &&74git mailinfo info-from/msg info-from/patch \75<info-from/0001 >info-from/out &&76test_cmp "$TEST_DIRECTORY"/t5100/info-from.expect info-from/out7778'7980test_done