diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2018-01-18 19:03:17 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-01-18 19:04:58 +0200 |
commit | f74ed5e0a431cc70bba6832ef05c0615a1dc846d (patch) | |
tree | 3f9fc6cb08febd7b16bf2f490d9fea4a79be3844 | |
parent | ff37d4b566f71796cb75cba37e2db47ff22cdf11 (diff) | |
download | mailutils-f74ed5e0a431cc70bba6832ef05c0615a1dc846d.tar.gz mailutils-f74ed5e0a431cc70bba6832ef05c0615a1dc846d.tar.bz2 |
Fix header field alignment in header output of the mail command
* mail/from.c (compile_headline): Honor the alingment setting.
* mail/tests/align.at: New testcase.
* mail/tests/Makefile.am: Add new testcase.
* mail/tests/testsuite.at: Include new testcase.
-rw-r--r-- | mail/from.c | 4 | ||||
-rw-r--r-- | mail/tests/Makefile.am | 1 | ||||
-rw-r--r-- | mail/tests/align.at | 43 | ||||
-rw-r--r-- | mail/tests/testsuite.at | 1 |
4 files changed, 47 insertions, 2 deletions
diff --git a/mail/from.c b/mail/from.c index 84e358c0b..1a99a0a4c 100644 --- a/mail/from.c +++ b/mail/from.c @@ -402,8 +402,8 @@ compile_headline (const char *str) int align; size_t width; -#define ALIGN_STRING (align == ALIGN_UNDEF ? ALIGN_LEFT : ALIGN_RIGHT) -#define ALIGN_NUMBER (align == ALIGN_UNDEF ? ALIGN_RIGHT : ALIGN_LEFT) +#define ALIGN_STRING (align == ALIGN_UNDEF ? ALIGN_LEFT : align) +#define ALIGN_NUMBER (align == ALIGN_UNDEF ? ALIGN_RIGHT : align) #define ATTACH(p) \ do \ { \ diff --git a/mail/tests/Makefile.am b/mail/tests/Makefile.am index cbcc1f064..e6039ce4e 100644 --- a/mail/tests/Makefile.am +++ b/mail/tests/Makefile.am @@ -39,6 +39,7 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac ## ------------ ## TESTSUITE_AT =\ + align.at\ cols00.at\ cols01.at\ copy00.at\ diff --git a/mail/tests/align.at b/mail/tests/align.at new file mode 100644 index 000000000..69749ae67 --- /dev/null +++ b/mail/tests/align.at @@ -0,0 +1,43 @@ +# This file is part of GNU Mailutils. -*- Autotest -*- +# Copyright (C) 2017 Free Software Foundation, Inc. +# +# GNU Mailutils is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3, or (at +# your option) any later version. +# +# GNU Mailutils is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. + +# Description: Mailutils up to 3.2 ignored alignment settings in 'set +# headline' mail command. +# Reported-By: Dan Jacobson <jidanni@jidanni.org> +# References: <87tvvjo2vw.fsf@jidanni.org>, +# http://lists.gnu.org/archive/html/bug-mailutils/2018-01/msg00005.html + +AT_SETUP([header alignment]) +AT_KEYWORDS([header alignment]) + +AT_CHECK([ +MUT_MBCOPY($abs_top_srcdir/testsuite/spool/mbox) +MUT_MAIL_CMD --exec='set headline=">%20d<"' --headers -f ./mbox +MUT_MAIL_CMD --exec='set headline=">%-20d<"' --headers -f ./mbox +MUT_MAIL_CMD --exec='set headline=">%+20d<"' --headers -f ./mbox +MUT_MAIL_CMD --exec='set headline=">%20o<"' --headers -f ./mbox +MUT_MAIL_CMD --exec='set headline=">%-20o<"' --headers -f ./mbox +MUT_MAIL_CMD --exec='set headline=">%+20o<"' --headers -f ./mbox +], +[0], +[>Tue Jul 16 12:11 < +>Tue Jul 16 12:11 < +> Tue Jul 16 12:11< +> 390< +>390 < +> 390< +]) +AT_CLEANUP diff --git a/mail/tests/testsuite.at b/mail/tests/testsuite.at index 94fb10a54..b8dee8e09 100644 --- a/mail/tests/testsuite.at +++ b/mail/tests/testsuite.at @@ -30,3 +30,4 @@ m4_include([copy01.at]) m4_include([copy02.at]) m4_include([copy03.at]) m4_include([copy04.at]) +m4_include([align.at])
\ No newline at end of file |