From 220857595d567997752e7e10279882ceac9516ae Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Sun, 15 Jul 2018 13:28:13 +0200 Subject: [PATCH] Add test to check for correct handling of long lines --- test/tests/show/test-longlines | 107 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 test/tests/show/test-longlines diff --git a/test/tests/show/test-longlines b/test/tests/show/test-longlines new file mode 100644 index 0000000..8079e4d --- /dev/null +++ b/test/tests/show/test-longlines @@ -0,0 +1,107 @@ +#!/bin/sh +###################################################### +# +# Test long header line handling (998 chars) +# +###################################################### + +set -e + +expected=$MH_TEST_DIR/$$.expected +actual=$MH_TEST_DIR/$$.actual + +genlongsubject() { + len="${1:-998}" + awk -v len="$len" 'BEGIN { + prefix = "Subject: " len + while (i++ $msgfile <<-EOF +From: foo@example.edu +To: bar@example.edu +`genlongsubject $len` +Date: Sun, 15 Jul 2018 12:26:59 +0200 + +foo +EOF + +# check it +cat > $expected <<-EOF +Date: Sun, 15 Jul 2018 12:26:59 +0200 +From: foo@example.edu +To: bar@example.edu +`genlongsubject $len` + +part text/plain 4 +foo +EOF + +COLUMNS=2000 show $msgnum > $actual 2>&1 +diff -u $expected $actual + + +len=998 + +# Write message with long header line +msgfile=$(mhpath b) +msgnum=$(basename $msgfile) +cat > $msgfile <<-EOF +From: foo@example.edu +To: bar@example.edu +`genlongsubject $len` +Date: Sun, 15 Jul 2018 12:26:59 +0200 + +foo +EOF + +# check it +cat > $expected <<-EOF +Date: Sun, 15 Jul 2018 12:26:59 +0200 +From: foo@example.edu +To: bar@example.edu +`genlongsubject $len` + +part text/plain 4 +foo +EOF + +COLUMNS=2000 show $msgnum > $actual 2>&1 +diff -u $expected $actual + + +len=999 + +# Write message with long header line +msgfile=$(mhpath b) +msgnum=$(basename $msgfile) +cat > $msgfile <<-EOF +From: foo@example.edu +To: bar@example.edu +`genlongsubject $len` +Date: Sun, 15 Jul 2018 12:26:59 +0200 + +foo +EOF + +# check it +cat > $expected <<-EOF +mhl: format error in message 13 +part text/plain 4 +foo +EOF + +COLUMNS=2000 show $msgnum > $actual 2>&1 +diff -u $expected $actual + -- 1.7.10.4