aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2022-07-01 18:45:45 -0300
committerDavid Bremner <david@tethera.net>2022-07-30 08:42:12 -0300
commitb3d466bf397a6f8d70bb50d6fa22c58e3d44badf (patch)
tree883e233c748bd6193aecb0cd2879cfefce2eab9b /test
parent4612f3eb3dbf16bf98ccbadef77d7a6f6361e692 (diff)
emacs/show: provide notmuch-show-choose-duplicate
This new command allows the user to interactively choose a different duplicate (file) to display for a given message in notmuch-show-mode. Since both tree and unthreaded view use notmuch-show-mode, this provides the same facility there.
Diffstat (limited to 'test')
-rwxr-xr-xtest/T450-emacs-show.sh29
-rwxr-xr-xtest/T460-emacs-tree.sh14
-rwxr-xr-xtest/T465-emacs-unthreaded.sh15
3 files changed, 58 insertions, 0 deletions
diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh
index 64f174cf..9cc90d91 100755
--- a/test/T450-emacs-show.sh
+++ b/test/T450-emacs-show.sh
@@ -338,4 +338,33 @@ when we detect the word "attachment" and there's no attach? :p
EOF
test_expect_equal_file EXPECTED OUTPUT
+add_email_corpus duplicate
+
+ID3=87r2ecrr6x.fsf@zephyr.silentflame.com
+test_begin_subtest "duplicate=3"
+test_emacs "(notmuch-show \"id:${ID3}\")
+ (notmuch-show-choose-duplicate 3)
+ (test-visible-output \"OUTPUT\")"
+output=$(grep "Subject:" OUTPUT)
+file=$(notmuch search --output=files id:${ID3} | head -n 3 | tail -n 1)
+subject=$(grep '^Subject:' $file)
+test_expect_equal "$output" "$subject"
+
+test_begin_subtest "duplicate=0"
+test_emacs "(test-log-error
+ (notmuch-show \"id:${ID3}\")
+ (notmuch-show-choose-duplicate 0))"
+cat <<EOF > EXPECTED
+(error Duplicate 0 out of range [1,5])
+EOF
+test_expect_equal_file EXPECTED MESSAGES
+
+test_begin_subtest "duplicate=1000"
+test_emacs "(test-log-error
+ (notmuch-show \"id:${ID3}\")
+ (notmuch-show-choose-duplicate 1000))"
+cat <<EOF > EXPECTED
+(error Duplicate 1000 out of range [1,5])
+EOF
+test_expect_equal_file EXPECTED MESSAGES
test_done
diff --git a/test/T460-emacs-tree.sh b/test/T460-emacs-tree.sh
index 0f23b418..bae26e3b 100755
--- a/test/T460-emacs-tree.sh
+++ b/test/T460-emacs-tree.sh
@@ -200,4 +200,18 @@ test_emacs '(test-log-error
(notmuch-tree "*")))'
test_expect_equal "$(cat MESSAGES)" "COMPLETE"
+add_email_corpus duplicate
+
+ID3=87r2ecrr6x.fsf@zephyr.silentflame.com
+test_begin_subtest "duplicate=3"
+test_emacs "(notmuch-tree \"id:${ID3}\")
+ (notmuch-test-wait)
+ (notmuch-tree-show-message t)
+ (notmuch-show-choose-duplicate 3)
+ (test-visible-output \"OUTPUT\")"
+output=$(grep "Subject:" OUTPUT)
+file=$(notmuch search --output=files id:${ID3} | head -n 3 | tail -n 1)
+subject=$(grep '^Subject:' $file)
+test_expect_equal "$output" "$subject"
+
test_done
diff --git a/test/T465-emacs-unthreaded.sh b/test/T465-emacs-unthreaded.sh
index e7bc1439..9b96c7d7 100755
--- a/test/T465-emacs-unthreaded.sh
+++ b/test/T465-emacs-unthreaded.sh
@@ -57,4 +57,19 @@ test_emacs '(test-log-error
(notmuch-unthreaded "*")))'
test_expect_equal "$(cat MESSAGES)" "COMPLETE"
+add_email_corpus duplicate
+
+ID3=87r2ecrr6x.fsf@zephyr.silentflame.com
+test_begin_subtest "duplicate=3"
+test_emacs "(let ((notmuch-tree-show-out t))
+ (notmuch-unthreaded \"id:${ID3}\")
+ (notmuch-test-wait)
+ (notmuch-tree-show-message nil)
+ (notmuch-show-choose-duplicate 3)
+ (test-visible-output \"OUTPUT\"))"
+output=$(grep "Subject:" OUTPUT)
+file=$(notmuch search --output=files id:${ID3} | head -n 3 | tail -n 1)
+subject=$(grep '^Subject:' $file)
+test_expect_equal "$output" "$subject"
+
test_done