Although some more complex scenarios are tested, the basic adding and
removing of non-S flags seems to be undercovered before this change.
---
test/T340-maildir-sync.sh | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/test/T340-maildir-sync.sh b/test/T340-maildir-sync.sh
index a697317f..5b487405 100755
--- a/test/T340-maildir-sync.sh
+++ b/test/T340-maildir-sync.sh
@@ -4,11 +4,45 @@ test_description="maildir synchronization"
. $(dirname "$0")/test-lib.sh || exit 1
+declare -A tag_map
+# 'S' is handled separately
+tag_map=(D draft F flagged P passed R replied)
+
# Create the expected maildir structure
mkdir $MAIL_DIR/cur
mkdir $MAIL_DIR/new
mkdir $MAIL_DIR/tmp
+for flag in D F P R; do
+ notmuch config set new.tags ""
+ test_begin_subtest "Adding flag '$flag' adds tag '${tag_map[$flag]}'"
+ add_message [subject]="\"Adding ${flag} flag\""
[filename]="adding-${flag}-flag:2," [dir]=cur
+ notmuch dump id:$gen_msg_id | tail -1 > OUTPUT
+ mv "${gen_msg_filename}" "${gen_msg_filename}${flag}"
+ $(NOTMUCH_NEW)
+ notmuch dump id:$gen_msg_id | tail -1 >> OUTPUT
+ cat <<EOF > EXPECTED
++unread -- id:adding-${flag}-flag@notmuch-test-suite
++${tag_map[$flag]} +unread -- id:adding-${flag}-flag@notmuch-test-suite
+EOF
+ test_expect_equal_file EXPECTED OUTPUT
+
+ test_begin_subtest "Removing flag '$flag' removes tag '${tag_map[$flag]}'"
+ base="adding-${flag}-flag"
+ id="${base}@notmuch-test-suite"
+ filename="mail/cur/$base:2,${tag}"
+ notmuch dump id:$id | tail -1 > OUTPUT
+ mv "${filename}${flag}" "${filename}"
+ $(NOTMUCH_NEW)
+ notmuch dump id:$id | tail -1 >> OUTPUT
+ cat <<EOF > EXPECTED
++${tag_map[$flag]} +unread -- id:adding-${flag}-flag@notmuch-test-suite
++unread -- id:adding-${flag}-flag@notmuch-test-suite
+EOF
+ test_expect_equal_file EXPECTED OUTPUT
+ notmuch config set new.tags
+done
+
test_begin_subtest "Adding 'S' flag to existing filename removes 'unread' tag"
add_message [subject]='"Adding S flag"' [filename]='adding-s-flag:2,' [dir]=cur
output=$(notmuch search subject:"Adding S flag" | notmuch_search_sanitize)
@@ -58,7 +92,7 @@ test_expect_equal_json "$output" '[[[{"id": "XXXXX",
"Date": "GENERATED_DATE"},
"body": [{"id": 1,
"content-type": "text/plain",
-"content": "This is just a test message (#4)\n"}]},
+"content": "This is just a test message (#8)\n"}]},
[]]]]'
test_begin_subtest "notmuch reply works with renamed file (without notmuch
new)"
--
2.51.0
_______________________________________________
notmuch mailing list -- [email protected]
To unsubscribe send an email to [email protected]