aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/T370-search-folder-coherence.sh
diff options
context:
space:
mode:
authorGravatar Tomi Ollila <tomi.ollila@iki.fi>2014-01-09 17:18:59 +0200
committerGravatar David Bremner <david@tethera.net>2014-01-13 14:16:46 -0400
commita755c9d6a9099366cc82ba3a4bee8e6d2b83d529 (patch)
treee17400d2996686722eb94404902f62043b764237 /test/T370-search-folder-coherence.sh
parent84719b08f757a6079f4c3331d0c476d19b265948 (diff)
test: renamed test scripts to format T\d\d\d-name.sh
All test scripts to be executed are now named as T\d\d\d-name.sh, numers in increments of 10. This eases adding new tests and developers to see which are test scripts that are executed by test suite and in which order.
Diffstat (limited to 'test/T370-search-folder-coherence.sh')
-rwxr-xr-xtest/T370-search-folder-coherence.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/T370-search-folder-coherence.sh b/test/T370-search-folder-coherence.sh
new file mode 100755
index 00000000..3f6ec763
--- /dev/null
+++ b/test/T370-search-folder-coherence.sh
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+test_description='folder tags removed and added through file renames remain consistent'
+. ./test-lib.sh
+
+test_begin_subtest "No new messages"
+output=$(NOTMUCH_NEW)
+test_expect_equal "$output" "No new mail."
+
+
+test_begin_subtest "Single new message"
+generate_message
+file_x=$gen_msg_filename
+id_x=$gen_msg_id
+output=$(NOTMUCH_NEW)
+test_expect_equal "$output" "Added 1 new message to the database."
+
+test_begin_subtest "Add second folder for same message"
+dir=$(dirname $file_x)
+mkdir $dir/spam
+cp $file_x $dir/spam
+output=$(NOTMUCH_NEW)
+test_expect_equal "$output" "No new mail."
+
+
+test_begin_subtest "Multiple files for same message"
+cat <<EOF >EXPECTED
+MAIL_DIR/msg-001
+MAIL_DIR/spam/msg-001
+EOF
+notmuch search --output=files id:$id_x | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "Test matches folder:spam"
+output=$(notmuch search folder:spam)
+test_expect_equal "$output" "thread:0000000000000001 2001-01-05 [1/1] Notmuch Test Suite; Single new message (inbox unread)"
+
+test_begin_subtest "Remove folder:spam copy of email"
+rm $dir/spam/$(basename $file_x)
+output=$(NOTMUCH_NEW)
+test_expect_equal "$output" "No new mail. Detected 1 file rename."
+
+test_begin_subtest "No mails match the folder:spam search"
+output=$(notmuch search folder:spam)
+test_expect_equal "$output" ""
+
+test_done