aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLars Kotthoff <larsko@uwyo.edu>2023-12-22 14:06:34 -0700
committerDavid Bremner <david@tethera.net>2024-07-26 15:59:11 +0900
commitd34720e7b35da771d9a06ee8dbdc158680684e99 (patch)
treedbee65525861e729f77042b84f678c9b9ef81e2e /test
parent199e2de224440833d07665e4cf779a88f3d52863 (diff)
config: allow custom separators in author lists
Allow distinguishing between commas separating authors and separating first and last names. Amended by db: reformat NEWS entry and commit message. Tweaked whitespace in lib/thread.cc.
Diffstat (limited to 'test')
-rwxr-xr-xtest/T030-config.sh2
-rwxr-xr-xtest/T055-path-config.sh4
-rwxr-xr-xtest/T206-author-separator.sh26
-rwxr-xr-xtest/T590-libconfig.sh10
4 files changed, 42 insertions, 0 deletions
diff --git a/test/T030-config.sh b/test/T030-config.sh
index 621e0b69..1d2b7df8 100755
--- a/test/T030-config.sh
+++ b/test/T030-config.sh
@@ -63,6 +63,8 @@ index.as_text=
maildir.synchronize_flags=true
new.ignore=
new.tags=unread;inbox
+search.authors_matched_separator=|
+search.authors_separator=,
search.exclude_tags=
user.name=Notmuch Test Suite
user.other_email=test_suite_other@notmuchmail.org;test_suite@otherdomain.org
diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh
index 1feb5624..049b745e 100755
--- a/test/T055-path-config.sh
+++ b/test/T055-path-config.sh
@@ -303,6 +303,8 @@ index.as_text=
maildir.synchronize_flags=true
new.ignore=
new.tags=unread;inbox
+search.authors_matched_separator=|
+search.authors_separator=,
search.exclude_tags=
user.name=Notmuch Test Suite
user.other_email=test_suite_other@notmuchmail.org;test_suite@otherdomain.org
@@ -325,6 +327,8 @@ database.mail_root
database.path
maildir.synchronize_flags
new.tags
+search.authors_matched_separator
+search.authors_separator
user.name
user.other_email
user.primary_email
diff --git a/test/T206-author-separator.sh b/test/T206-author-separator.sh
new file mode 100755
index 00000000..b8b1afb4
--- /dev/null
+++ b/test/T206-author-separator.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+test_description="custom separator for authors"
+. $(dirname "$0")/test-lib.sh || exit 1
+
+test_begin_subtest "Adding parent message"
+generate_message [body]=findme [id]=new-parent-id [subject]=author-reorder-threadtest '[from]="User <user@example.com>"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
+output=$(NOTMUCH_NEW)
+test_expect_equal "$output" "Added 1 new message to the database."
+
+test_begin_subtest "Adding initial child message"
+generate_message [body]=findme "[in-reply-to]=\<new-parent-id\>" [subject]=author-reorder-threadtest '[from]="last name, first name <user1@example.com>"' '[date]="Sat, 01 Jan 2000 12:01:00 -0000"'
+output=$(NOTMUCH_NEW)
+test_expect_equal "$output" "Added 1 new message to the database."
+
+test_begin_subtest "Adding second child message"
+generate_message [body]=findme "[in-reply-to]=\<new-parent-id\>" [subject]=author-reorder-threadtest '[from]="first last <user2@example.com>"' '[date]="Sat, 01 Jan 2000 12:02:00 -0000"'
+output=$(NOTMUCH_NEW)
+test_expect_equal "$output" "Added 1 new message to the database."
+
+test_begin_subtest "Custom separarator is used"
+notmuch config set search.authors_matched_separator "#"
+notmuch config set search.authors_separator ";"
+output=$(notmuch search from:user | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX 2000-01-01 [1/3] User#last name, first name;first last; author-reorder-threadtest (inbox unread)"
+
+test_done
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index 9326ba3e..9b364895 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -441,6 +441,8 @@ cat <<'EOF' >EXPECTED
11: '8000'
12: 'NULL'
13: ''
+14: ', '
+15: '| '
== stderr ==
EOF
unset MAILDIR
@@ -725,6 +727,8 @@ test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "list by keys (ndlc)"
notmuch config set search.exclude_tags "foo;bar;fub"
+notmuch config set search.authors_matched_separator "| "
+notmuch config set search.authors_separator ", "
notmuch config set new.ignore "sekrit_junk"
notmuch config set index.as_text "text/"
cat c_head2 - c_tail <<'EOF' | test_C ${MAIL_DIR} %NULL% %NULL%
@@ -754,6 +758,8 @@ cat <<'EOF' >EXPECTED
11: '8000'
12: 'NULL'
13: 'text/'
+14: ', '
+15: '| '
== stderr ==
EOF
test_expect_equal_file EXPECTED OUTPUT
@@ -789,6 +795,8 @@ cat <<'EOF' >EXPECTED
11: '8000'
12: 'NULL'
13: ''
+14: ', '
+15: '| '
== stderr ==
EOF
test_expect_equal_file EXPECTED OUTPUT.clean
@@ -865,6 +873,8 @@ key with spaces value, with, spaces!
maildir.synchronize_flags true
new.ignore sekrit_junk
new.tags unread;inbox
+search.authors_matched_separator |
+search.authors_separator ,
search.exclude_tags foo;bar;fub
show.extra_headers (null)
test.key1 testvalue1