mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-23 03:18:08 +01:00
db97cb5b65
Before the change, messages generated by generate_message() used "Test message #N" for default subject where N is the generated messages counter. Since message subject is commonly present in expected results, there is a chance of breaking other tests when a new generate_message() call is added. The patch changes default subject value for generated messages to subtest name if it is available. If subtest name is not available (i.e. message is generated during test initialization), the old default value is used (in this case it is fine to have the counter in the subject). Another benefit of this change is a sane default value for subject in generated messages, which would allow to simplify code like: test_begin_subtest "test for a cool feature" add_message [subject]="message for test for a cool feature"
46 lines
1.3 KiB
Bash
Executable file
46 lines
1.3 KiB
Bash
Executable file
#!/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
|