}'
}
+addcr() {
+ awk '{printf($0 "\r\n")}'
+}
+
+
len=997
# Write message with long header line
COLUMNS=2000 show $msgnum > $actual 2>&1
diff -u $expected $actual
+
+
+# now with CRLF
+
+
+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 | addcr`
+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 | addcr`
+Date: Sun, 15 Jul 2018 12:26:59 +0200
+
+foo
+EOF
+
+# check it
+cat > $expected <<-EOF
+mhl: format error in message 15
+part text/plain 4
+foo
+EOF
+
+COLUMNS=2000 show $msgnum > $actual 2>&1
+diff -u $expected $actual
+