[PATCH v5 12/12] test: test insert --create-folder option
Peter Wang
novalazy at gmail.com
Tue Apr 2 15:41:57 PDT 2013
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
More information about the notmuch
mailing list