about summary refs log tree commit diff
path: root/t
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2021-05-09 14:37:19 +0200
committerLeah Neukirchen <leah@vuxu.org>2021-05-09 22:00:32 +0200
commit7d049328136b466a33279ced6e2de46e4a41a3ef (patch)
tree7bb86bfbb7fdc1f7090c18c644e2804756728ad1 /t
parent5b52110399e991fa03480bfeb529e1fd0749fcc3 (diff)
downloadmblaze-7d049328136b466a33279ced6e2de46e4a41a3ef.tar.gz
mblaze-7d049328136b466a33279ced6e2de46e4a41a3ef.tar.xz
mblaze-7d049328136b466a33279ced6e2de46e4a41a3ef.zip
mexport: ensure mbox entries are separated by an empty line
https://www.loc.gov/preservation/digital/formats/fdd/fdd000383.shtml
> Each message is immediately prefaced by a separation line and
> terminated by an empty line.

Bug discovered by skarnet.
Diffstat (limited to 't')
-rwxr-xr-xt/1800-mexport.t26
1 files changed, 26 insertions, 0 deletions
diff --git a/t/1800-mexport.t b/t/1800-mexport.t
new file mode 100755
index 0000000..c0eadbd
--- /dev/null
+++ b/t/1800-mexport.t
@@ -0,0 +1,26 @@
+#!/bin/sh -e
+cd ${0%/*}
+. ./lib.sh
+plan 2
+
+cat <<EOF >tmp.1
+Subject: message 1
+
+This is message 1.
+EOF
+
+cat <<EOF >tmp.2
+Subject: message 2
+
+This is message 2.  It has a trailing empty line.
+
+EOF
+
+printf >tmp.3 'Subject: message 3
+
+This is message 3.  It has a no trailing newline, oops.'
+
+mexport ./tmp.1 ./tmp.2 ./tmp.3 >./tmp.mbox
+
+check 'generated mbox has 16 lines' 'cat ./tmp.mbox | wc -l | grep 16'
+check 'generated mbox has 7 empty lines' 'grep -c "^$" ./tmp.mbox | grep 7'