From: Peter Wang <novalazy@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH v5 12/12] test: test insert --create-folder option
Date: Wed, 3 Apr 2013 09:41:57 +1100 [thread overview]
Message-ID: <1364942517-6982-13-git-send-email-novalazy@gmail.com> (raw)
In-Reply-To: <1364942517-6982-1-git-send-email-novalazy@gmail.com>
Add tests for notmuch insert --create-folder option.
---
test/insert | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/test/insert b/test/insert
index 44e071c..24a61e1 100755
--- a/test/insert
+++ b/test/insert
@@ -83,4 +83,28 @@ gen_insert_msg
test_expect_code 1 "Insert message, non-existent folder" \
"notmuch insert --folder=nonesuch < $gen_msg_filename"
+test_begin_subtest "Insert message, create folder"
+gen_insert_msg
+notmuch insert --folder=F --create-folder +folder < "$gen_msg_filename"
+output=$(notmuch search --output=files folder:F tag:folder)
+basename=$(basename "$output")
+test_expect_equal_file "$gen_msg_filename" "$MAIL_DIR/F/cur/${basename}"
+
+test_begin_subtest "Insert message, create subfolder"
+gen_insert_msg
+notmuch insert --folder=F/G/H/I/J --create-folder +folder < "$gen_msg_filename"
+output=$(notmuch search --output=files folder:F/G/H/I/J tag:folder)
+basename=$(basename "$output")
+test_expect_equal_file "$gen_msg_filename" "${MAIL_DIR}/F/G/H/I/J/cur/${basename}"
+
+test_begin_subtest "Insert message, create existing subfolder"
+gen_insert_msg
+notmuch insert --folder=F/G/H/I/J --create-folder +folder < "$gen_msg_filename"
+output=$(notmuch count folder:F/G/H/I/J tag:folder)
+test_expect_equal "$output" "2"
+
+gen_insert_msg
+test_expect_code 1 "Insert message, create invalid subfolder" \
+ "notmuch insert --folder=../G --create-folder $gen_msg_filename"
+
test_done
--
1.7.12.1
prev parent reply other threads:[~2013-04-02 22:43 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-02 22:41 [PATCH v5 00/12] insert command Peter Wang
2013-04-02 22:41 ` [PATCH v5 01/12] tag-util: move out 'tag' command-line checks Peter Wang
2013-04-02 22:41 ` [PATCH v5 02/12] tag-util: do not reset list in parse_tag_command_line Peter Wang
2013-04-02 22:41 ` [PATCH v5 03/12] cli: add insert command Peter Wang
2013-04-27 21:24 ` Jani Nikula
2013-05-28 13:58 ` Peter Wang
2013-04-02 22:41 ` [PATCH v5 04/12] man: document 'insert' command Peter Wang
2013-04-27 21:27 ` Jani Nikula
2013-04-02 22:41 ` [PATCH v5 05/12] man: reference notmuch-insert.1 Peter Wang
2013-04-02 22:41 ` [PATCH v5 06/12] test: add tests for insert Peter Wang
2013-04-02 22:41 ` [PATCH v5 07/12] insert: add --folder option Peter Wang
2013-04-27 21:32 ` Jani Nikula
2013-04-28 2:00 ` Peter Wang
2013-04-02 22:41 ` [PATCH v5 08/12] man: document insert " Peter Wang
2013-04-02 22:41 ` [PATCH v5 09/12] test: test " Peter Wang
2013-04-02 22:41 ` [PATCH v5 10/12] insert: add --create-folder option Peter Wang
2013-04-02 22:41 ` [PATCH v5 11/12] man: document insert --create-folder Peter Wang
2013-04-02 22:41 ` Peter Wang [this message]
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=1364942517-6982-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).