diff options
author | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2019-11-25 01:53:54 -0500 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2019-11-25 07:46:31 -0700 |
commit | e9e26fa3d84b9d38c4a33fb33f890b21b482ef13 (patch) | |
tree | a978cd678bebf751ca72c29ac3bfc626ba6f6895 | |
parent | 0f4661cde91646c0481d00413d1188cf538829d5 (diff) | |
download | mailscripts-e9e26fa3d84b9d38c4a33fb33f890b21b482ef13.tar.gz |
email-print-mime-structure: simple baseline test suite
I want to ensure that any changes don't ultimately break the behavior
of email-print-mime-structure.
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rwxr-xr-x | tests/email-print-mime-structure.sh | 8 | ||||
-rw-r--r-- | tests/email-print-mime-structure/alternative.eml | 18 | ||||
-rw-r--r-- | tests/email-print-mime-structure/alternative.out | 3 | ||||
-rw-r--r-- | tests/email-print-mime-structure/attachment.eml | 26 | ||||
-rw-r--r-- | tests/email-print-mime-structure/attachment.out | 5 | ||||
-rw-r--r-- | tests/email-print-mime-structure/simple.eml | 9 | ||||
-rw-r--r-- | tests/email-print-mime-structure/simple.out | 1 |
9 files changed, 75 insertions, 0 deletions
@@ -7,6 +7,9 @@ COMPLETIONS=completions/bash/email-print-mime-structure all: $(MANPAGES) $(COMPLETIONS) +check: + ./tests/email-print-mime-structure.sh + clean: rm -f $(MANPAGES) rm -rf completions diff --git a/debian/control b/debian/control index 72b57c3..bf49458 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,9 @@ Build-Depends: bash-completion, debhelper (>= 10), dh-elpa, + diffutils <!nocheck>, perl, + python3 <!nocheck>, python3-argcomplete, Vcs-Git: https://git.spwhitton.name/mailscripts Vcs-Browser: https://git.spwhitton.name/mailscripts diff --git a/tests/email-print-mime-structure.sh b/tests/email-print-mime-structure.sh new file mode 100755 index 0000000..5efa2ca --- /dev/null +++ b/tests/email-print-mime-structure.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e + +for eml in tests/email-print-mime-structure/*.eml; do + printf "Testing %s\n" "${eml##*/}" + diff -u "${eml%%.eml}.out" <(./email-print-mime-structure < "$eml") +done diff --git a/tests/email-print-mime-structure/alternative.eml b/tests/email-print-mime-structure/alternative.eml new file mode 100644 index 0000000..9b7723d --- /dev/null +++ b/tests/email-print-mime-structure/alternative.eml @@ -0,0 +1,18 @@ +Date: Sun, 24 Nov 2019 21:13:45 -0500
+Subject: test message
+Message-ID: <alternative@mailscripts.example>
+From: Alice <alice@mailscripts.example>
+To: Bob <bob@mailscripts.example>
+Content-Type: multipart/alternative; boundary="abc123"
+
+--abc123
+Content-Type: text/plain
+
+This is a simple message
+
+--abc123
+Content-Type: text/html
+
+<html><head></head><body><p>This is a simple message</p></body></html>
+
+--abc123--
diff --git a/tests/email-print-mime-structure/alternative.out b/tests/email-print-mime-structure/alternative.out new file mode 100644 index 0000000..1c0165a --- /dev/null +++ b/tests/email-print-mime-structure/alternative.out @@ -0,0 +1,3 @@ +└┬╴multipart/alternative 414 bytes + ├─╴text/plain 26 bytes + └─╴text/html 72 bytes diff --git a/tests/email-print-mime-structure/attachment.eml b/tests/email-print-mime-structure/attachment.eml new file mode 100644 index 0000000..31baa7c --- /dev/null +++ b/tests/email-print-mime-structure/attachment.eml @@ -0,0 +1,26 @@ +Date: Sun, 24 Nov 2019 21:13:45 -0500
+Subject: test message
+Message-ID: <attachment@mailscripts.example>
+From: Alice <alice@mailscripts.example>
+To: Bob <bob@mailscripts.example>
+Content-Type: multipart/mixed; boundary="xyz"
+
+--xyz
+Content-Type: multipart/alternative; boundary="abc123"
+
+--abc123
+Content-Type: text/plain
+
+This is a simple message
+
+--abc123
+Content-Type: text/html
+
+<html><head></head><body><p>This is a simple message</p></body></html>
+
+--abc123--
+--xyz
+Content-Type: text/plain
+Content-Disposition: attachment; filename="test.txt"
+
+This is a simple attachment file.
diff --git a/tests/email-print-mime-structure/attachment.out b/tests/email-print-mime-structure/attachment.out new file mode 100644 index 0000000..f2ca543 --- /dev/null +++ b/tests/email-print-mime-structure/attachment.out @@ -0,0 +1,5 @@ +└┬╴multipart/mixed 594 bytes + ├┬╴multipart/alternative 234 bytes + │├─╴text/plain 26 bytes + │└─╴text/html 72 bytes + └─╴text/plain attachment [test.txt] 33 bytes diff --git a/tests/email-print-mime-structure/simple.eml b/tests/email-print-mime-structure/simple.eml new file mode 100644 index 0000000..36facec --- /dev/null +++ b/tests/email-print-mime-structure/simple.eml @@ -0,0 +1,9 @@ +Date: Sun, 24 Nov 2019 21:13:45 -0500
+Subject: test message
+Message-ID: <simple@mailscripts.example>
+From: Alice <alice@mailscripts.example>
+To: Bob <bob@mailscripts.example>
+
+This is a simple message
+
+
diff --git a/tests/email-print-mime-structure/simple.out b/tests/email-print-mime-structure/simple.out new file mode 100644 index 0000000..7ac3514 --- /dev/null +++ b/tests/email-print-mime-structure/simple.out @@ -0,0 +1 @@ +└─╴text/plain 30 bytes |