Debian Codegraph @

test/mhshow/test-eof-newline

raw
1 #!/bin/sh
2 ######################################################
3 #
4 # Test mhparse on lack of newline at end of file.
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 expected="$MH_TEST_DIR/$$.expected"
20 actual="$MH_TEST_DIR/$$.actual"
21
22 # check message without newline at end
23 start_test "message without newline at end"
24 msgfile=`mhpath new`
25 msgnum=`basename $msgfile`
26 printf %s >"$msgfile" \
27 "Content-Type: multipart/alternative; boundary=2b693c177a9c8680f38e8386a161840e
28 Date: Tue, 09 Mar 2021 14:08:54 +0000 (UTC)
29 Mime-Version: 1.0
30
31 --2b693c177a9c8680f38e8386a161840e
32 Content-Transfer-Encoding: quoted-printable
33 Content-Type: text/plain; charset=UTF-8
34 Mime-Version: 1.0
35
36 There isn't a newline at the end of this file.
37
38 --2b693c177a9c8680f38e8386a161840e
39 Content-Transfer-Encoding: quoted-printable
40 Content-Type: text/html; charset=UTF-8
41 Mime-Version: 1.0
42
43 <!DOCTYPE html>
44 <html><body>
45 There isn't a newline at the end of this file.
46 </body></html>
47
48 --2b693c177a9c8680f38e8386a161840e--"
49
50 # Write the expected output.
51 cat >"$expected" <<EOF
52 [ Message inbox:11 ]
53 [ part 2 - text/plain - 47B ]
54 There isn't a newline at the end of this file.
55 EOF
56
57 run_prog mhshow -part 2 -form mhl.null $msgnum >"$actual" 2>&1
58 check "$expected" "$actual" : check number 1
59
60
61 finish_test
62 exit $failed