Trim trailing whitespace in scan and show
[mmh] / test / tests / scan / test-mh-format
1 #!/bin/sh
2 ######################################################
3 #
4 # Test trailing space handling in format files
5 #
6 ######################################################
7
8 . "$MH_TEST_COMMON"
9
10
11 msgfile=`mhpath b +inbox`
12 cat >"$msgfile" <<!
13 Subject: =?UTF-8?Q?3_trailing_spaces___?=
14 Mime-Version: 1.0
15 From: Bob <bob@example.org>
16 Date: Wed, 20 Apr 2016 07:38:12 +0200
17 Message-Id: <83C58147-7B2B-4B7F-9502-17C1EB9526BC@example.org>
18 To: Alice <alice@example.net>
19 Content-Type: text/plain; charset=utf-8
20
21 The subject line has three trailing spaces, inside the RFC 2047
22 encoding. They get removed if we first (decode) and afterwards
23 (trim) on diplay.
24 !
25
26
27 # output has no trailing spaces
28 runandcheck "scan -width 80 +inbox l" <<!
29   11  2016-04-20 07:38  Bob                3 trailing spaces
30 !
31
32
33
34 runandcheck "show +inbox l" <<!
35 Date:    Wed, 20 Apr 2016 07:38:12 +0200
36 From:    Bob <bob@example.org>
37 To:      Alice <alice@example.net>
38 Subject: 3 trailing spaces
39
40 part       text/plain                 145
41 The subject line has three trailing spaces, inside the RFC 2047
42 encoding. They get removed if we first (decode) and afterwards
43 (trim) on diplay.
44 !