unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob f8119cbb4d99be909045e1ddfab500e6813c1940 1360 bytes (raw)
name: test/search-folder-coherence 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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; Test message #1 (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

debug log:

solving f8119cb ...
found f8119cb in https://yhetil.org/notmuch.git/

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

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).