]> diplodocus.org Git - nmh/blob - test/mhshow/test-binary
Replace strlen("foo") with LEN("foo").
[nmh] / test / mhshow / test-binary
1 #!/bin/sh
2 ######################################################
3 #
4 # Test MIME parser on binary input
5 #
6 ######################################################
7
8 set -e
9
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir=`dirname "$0"`/../..
12 MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
13 fi
14
15 . "$MH_OBJ_DIR/test/common.sh"
16
17 setup_test
18
19 actual="$MH_TEST_DIR/test-binary$$.actual"
20 expected="$MH_TEST_DIR/test-binary$$.expected"
21
22 printf '%s\000%s' >"${expected}" \
23 "[ Message inbox:11 ]
24 To: recipient@example.edu
25 From: sender@example.edu
26 Subject: test binary content
27
28 MIME-Version: 1.0
29
30 [ part - text/plain - 23B ]
31 Here's a null byte: " ".
32 "
33
34 printf '%s\000%s' >`mhpath new` \
35 "From: sender@example.edu
36 To: recipient@example.edu
37 Subject: test binary content
38 MIME-Version: 1.0
39 Content-Type: text/plain; charset=UTF-8
40 Content-Transfer-Encoding: binary
41
42 Here's a null byte: " ".
43 "
44
45 run_prog mhshow last >"${actual}" 2>&1
46 check "${expected}" "${actual}"
47
48 finish_test
49 exit $failed