From: Peter Wang <novalazy@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH 13/18] test: add tests for insert
Date: Wed, 25 Jul 2012 23:42:42 +1000 [thread overview]
Message-ID: <1343223767-9812-13-git-send-email-novalazy@gmail.com> (raw)
In-Reply-To: <1343223767-9812-1-git-send-email-novalazy@gmail.com>
Add tests for new 'insert' command.
---
test/insert | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
test/notmuch-test | 1 +
2 files changed, 54 insertions(+), 0 deletions(-)
create mode 100755 test/insert
diff --git a/test/insert b/test/insert
new file mode 100755
index 0000000..3514920
--- /dev/null
+++ b/test/insert
@@ -0,0 +1,53 @@
+#!/usr/bin/env bash
+test_description='"notmuch insert"'
+. ./test-lib.sh
+
+# Create directories and database before inserting.
+mkdir -p "$MAIL_DIR"/{cur,new,tmp}
+mkdir -p "$MAIL_DIR"/Drafts/{cur,new,tmp}
+notmuch new > /dev/null
+
+# We use generate_message to create the temporary message file.
+# It happens to be in the mail directory already but that is okay.
+
+test_begin_subtest "Insert message, default"
+generate_message \
+ "[subject]=\"insert-subject\"" \
+ "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \
+ "[body]=\"insert-message\""
+notmuch insert < "$gen_msg_filename"
+test_expect_equal "`notmuch count subject:insert-subject tag:unread`" "1"
+
+test_begin_subtest "Insert message, add tag"
+generate_message \
+ "[subject]=\"insert-subject-addtag\"" \
+ "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \
+ "[body]=\"insert-message-addtag\""
+notmuch insert +custom < "$gen_msg_filename"
+test_expect_equal "`notmuch count tag:custom`" "1"
+
+test_begin_subtest "Insert message, add/remove tag"
+generate_message \
+ "[subject]=\"insert-subject-addrmtag\"" \
+ "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \
+ "[body]=\"insert-message-addrmtag\""
+notmuch insert -- +custom -unread < "$gen_msg_filename"
+test_expect_equal "`notmuch count tag:custom NOT tag:unread`" "1"
+
+test_begin_subtest "Insert message, folder"
+generate_message \
+ "[subject]=\"insert-subject-draft\"" \
+ "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \
+ "[body]=\"insert-message-draft\""
+notmuch insert --folder=Drafts < "$gen_msg_filename"
+test_expect_equal "`notmuch count folder:Drafts`" "1"
+
+test_begin_subtest "Insert message, folder and tags"
+generate_message \
+ "[subject]=\"insert-subject-draft\"" \
+ "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \
+ "[body]=\"insert-message-draft\""
+notmuch insert --folder=Drafts -- +draft -unread < "$gen_msg_filename"
+test_expect_equal "`notmuch count folder:Drafts tag:draft NOT tag:unread`" "1"
+
+test_done
diff --git a/test/notmuch-test b/test/notmuch-test
index ea39dfc..b40ba0b 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -22,6 +22,7 @@ TESTS="
config
new
count
+ insert
search
search-output
search-by-folder
--
1.7.4.4
next prev parent reply other threads:[~2012-07-25 13:44 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-25 13:42 [PATCH 01/18] cli: add stub for insert command Peter Wang
2012-07-25 13:42 ` [PATCH 02/18] insert: open database Peter Wang
2012-07-25 13:42 ` [PATCH 03/18] insert: open Maildir tmp file Peter Wang
2012-11-18 15:47 ` Mark Walters
2012-07-25 13:42 ` [PATCH 04/18] insert: copy stdin to " Peter Wang
2012-11-26 16:21 ` Ali Polatel
2012-07-25 13:42 ` [PATCH 05/18] insert: move file from Maildir tmp to new Peter Wang
2012-11-18 17:33 ` Mark Walters
2012-11-19 12:26 ` Peter Wang
2012-11-19 13:49 ` Mark Walters
2012-07-25 13:42 ` [PATCH 06/18] insert: add new message to database Peter Wang
2012-11-18 17:00 ` Mark Walters
2012-07-25 13:42 ` [PATCH 07/18] insert: add --folder option Peter Wang
2012-07-25 13:42 ` [PATCH 08/18] insert: check folder name Peter Wang
2012-07-25 13:42 ` [PATCH 09/18] insert: apply default tags to new message Peter Wang
2012-07-25 13:42 ` [PATCH 10/18] insert: parse command-line tag operations Peter Wang
2012-11-18 17:05 ` Mark Walters
2012-07-25 13:42 ` [PATCH 11/18] insert: apply " Peter Wang
2012-07-25 13:42 ` [PATCH 12/18] insert: add copyright line from notmuch-deliver Peter Wang
2012-07-25 13:42 ` Peter Wang [this message]
2012-07-25 13:42 ` [PATCH 14/18] man: document 'insert' command Peter Wang
2012-11-18 17:13 ` Mark Walters
2012-07-25 13:42 ` [PATCH 15/18] man: reference notmuch-insert.1 Peter Wang
2012-07-25 13:42 ` [PATCH 16/18] insert: add --create-folder option Peter Wang
2012-11-18 17:24 ` Mark Walters
2012-07-25 13:42 ` [PATCH 17/18] man: document insert " Peter Wang
2012-07-25 13:42 ` [PATCH 18/18] test: test insert --create-folder Peter Wang
2012-07-25 17:11 ` [PATCH 01/18] cli: add stub for insert command Jameson Graef Rollins
2012-07-26 0:49 ` Peter Wang
2012-11-19 12:15 ` David Bremner
2012-11-18 17:35 ` Mark Walters
2012-11-19 12:34 ` Peter Wang
2012-11-19 13:52 ` Mark Walters
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1343223767-9812-13-git-send-email-novalazy@gmail.com \
--to=novalazy@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).