unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Cc: jonas@bernoul.li, David Bremner <david@tethera.net>
Subject: [PATCH 1/3] test: add known broken tests for notuch-{before,after}-tag-hook
Date: Sat,  8 May 2021 09:11:11 -0300	[thread overview]
Message-ID: <20210508121113.3454994-2-david@tethera.net> (raw)
In-Reply-To: <20210508121113.3454994-1-david@tethera.net>

These tests illustrate the bug reported in id:87v97ytd2s.fsf@fastmail.fm
---
 test/T310-emacs.sh | 24 ++++++++++++++++++++++++
 test/test-lib.el   |  3 +++
 2 files changed, 27 insertions(+)

diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index 78ac19a8..5ebc8e66 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -161,6 +161,30 @@ test_emacs "(notmuch-show \"$os_x_darwin_thread\")
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)"
 
+test_begin_subtest "notmuch-show: before-tag-hook is run, variables are defined"
+test_subtest_known_broken
+output=$(test_emacs '(let ((notmuch-test-tag-hook-output nil)
+	          (notmuch-before-tag-hook (function notmuch-test-tag-hook)))
+	       (notmuch-show "id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com")
+	       (execute-kbd-macro "+activate-hook\n")
+	       (execute-kbd-macro "-activate-hook\n")
+	       notmuch-test-tag-hook-output)')
+test_expect_equal "$output" \
+'(("id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com" "-activate-hook")
+ ("id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com" "+activate-hook"))'
+
+test_begin_subtest "notmuch-show: after-tag-hook is run, variables are defined"
+test_subtest_known_broken
+output=$(test_emacs '(let ((notmuch-test-tag-hook-output nil)
+	          (notmuch-after-tag-hook (function notmuch-test-tag-hook)))
+	       (notmuch-show "id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com")
+	       (execute-kbd-macro "+activate-hook\n")
+	       (execute-kbd-macro "-activate-hook\n")
+	       notmuch-test-tag-hook-output)')
+test_expect_equal "$output" \
+'(("id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com" "-activate-hook")
+ ("id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com" "+activate-hook"))'
+
 test_begin_subtest "Message with .. in Message-Id:"
 add_message [id]=123..456@example '[subject]="Message with .. in Message-Id"'
 test_emacs '(notmuch-search "id:\"123..456@example\"")
diff --git a/test/test-lib.el b/test/test-lib.el
index 4de5b292..32d53736 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -99,6 +99,9 @@ running, quit if it terminated."
 (add-hook 'notmuch-hello-refresh-hook
 	  (lambda () (cl-incf notmuch-hello-refresh-hook-counter)))
 
+(defvar notmuch-test-tag-hook-output nil)
+(defun notmuch-test-tag-hook () (push (cons query tag-changes) notmuch-test-tag-hook-output))
+
 (defun notmuch-test-mark-links ()
   "Enclose links in the current buffer with << and >>."
   ;; Links are often created by jit-lock functions
-- 
2.30.2

  reply	other threads:[~2021-05-08 12:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-08 12:11 Updated fix for notmuch-{before,after}-tag-hook David Bremner
2021-05-08 12:11 ` David Bremner [this message]
2021-05-08 12:11 ` [PATCH 2/3] emacs: restore tag-changes and query bindings for tag hooks David Bremner
2021-05-08 12:11 ` [PATCH 3/3] NEWS: add NEWS for notmuch-{before,after}-tag-hook fixes David Bremner
2021-05-15 12:12 ` Updated fix for notmuch-{before,after}-tag-hook David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210508121113.3454994-2-david@tethera.net \
    --to=david@tethera.net \
    --cc=jonas@bernoul.li \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).