[PATCH 1/2] test: utility function to add a pre-generated message to the database.

David Bremner david at tethera.net
Thu Mar 1 18:35:07 PST 2012


From: David Bremner <bremner at debian.org>

For various "nasty" messages, it is easier to ship a message rather
than try to generate a message which causes a failure.
---
 test/test-lib.sh |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 2781506..17d0e48 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -376,6 +376,21 @@ ${template[body]}
 EOF
 }
 
+# Add an existing message to the notmuch database.
+#
+# expects a message on stdin.
+#
+# uses the variable gen_msg_cnt from generate_message.
+
+add_rfc822_message ()
+{
+    gen_msg_cnt=$((gen_msg_cnt + 1))
+    gen_msg_name="msg-$(printf "%03d" $gen_msg_cnt)"
+    gen_msg_filename="${MAIL_DIR}/$gen_msg_name"
+    cat >$gen_msg_filename
+    notmuch new > /dev/null
+}
+
 # Generate a new message and add it to the database.
 #
 # All of the arguments and return values supported by generate_message
-- 
1.7.9



More information about the notmuch mailing list