unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jonas Bernoulli <jonas@bernoul.li>
To: notmuch@notmuchmail.org
Subject: [PATCH v3 3/4] test: Remove misguided emacs testing utilities
Date: Mon, 27 Jul 2020 17:25:02 +0200	[thread overview]
Message-ID: <20200727152503.15939-4-jonas@bernoul.li> (raw)
In-Reply-To: <20200727152503.15939-1-jonas@bernoul.li>

The goal of this abstraction was to save space.  But that failed as
the result actually was that four trivial lines got replace with 15
fairly complicated lines.  The opposite of what it was supposed to
do.

Also it made it harder to come up with the fix in the previous commit;
simply grepping for the relevant symbols did not work because they get
constructed at run-time instead of appearing in the source file.
---
 test/test-lib.el | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/test/test-lib.el b/test/test-lib.el
index 15271b02..aae9e833 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -104,26 +104,15 @@ (defun orphan-watchdog (pid)
   "Initiate orphan watchdog check."
   (run-at-time 60 60 'orphan-watchdog-check pid))
 
-(defun hook-counter (hook)
-  "Count how many times a hook is called.  Increments
-`hook'-counter variable value if it is bound, otherwise does
-nothing."
-  (let ((counter (intern (concat (symbol-name hook) "-counter"))))
-    (if (boundp counter)
-	(set counter (1+ (symbol-value counter))))))
-
-(defun add-hook-counter (hook)
-  "Add hook to count how many times `hook' is called."
-  (add-hook hook (apply-partially 'hook-counter hook)))
-
-(add-hook-counter 'notmuch-hello-mode-hook)
-(add-hook-counter 'notmuch-hello-refresh-hook)
-
 (defvar notmuch-hello-mode-hook-counter -100
   "Tests that care about this counter must let-bind it to 0.")
+(add-hook 'notmuch-hello-mode-hook
+	  (lambda () (cl-incf notmuch-hello-mode-hook-counter)))
 
 (defvar notmuch-hello-refresh-hook-counter -100
   "Tests that care about this counter must let-bind it to 0.")
+(add-hook 'notmuch-hello-refresh-hook
+	  (lambda () (cl-incf notmuch-hello-refresh-hook-counter)))
 
 (defadvice notmuch-search-process-filter (around pessimal activate disable)
   "Feed notmuch-search-process-filter one character at a time."
-- 
2.26.0

  parent reply	other threads:[~2020-07-27 15:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-24 18:09 [PATCH 0/3] Adjust test for changes in Emacs 27 Jonas Bernoulli
2020-07-24 18:09 ` [PATCH 1/3] gitignore: Ignore generated sphinx.config Jonas Bernoulli
2020-07-24 18:28   ` David Bremner
2020-07-24 18:34     ` Jonas Bernoulli
2020-07-24 18:09 ` [PATCH 2/3] test: Deal with Emacs 27 switching to lexical scope by default Jonas Bernoulli
2020-07-24 18:09 ` [PATCH 3/3] test: Explicitly state that we want to sign with sender Jonas Bernoulli
2020-08-15 14:25   ` David Bremner
2020-07-26 21:26 ` [PATCH 0/3] Adjust test for changes in Emacs 27 Jonas Bernoulli
2020-07-26 21:26   ` [PATCH 1/3] gitignore: Ignore generated sphinx.config Jonas Bernoulli
2020-07-27 18:23     ` Tomi Ollila
2020-07-27 20:08       ` Jonas Bernoulli
2020-07-26 21:26   ` [PATCH 2/3] test: Deal with Emacs 27 switching to lexical scope by default Jonas Bernoulli
2020-07-27 11:34     ` David Bremner
2020-07-26 21:26   ` [PATCH 3/3] test: Explicitly state that we want to sign with sender Jonas Bernoulli
2020-07-27 15:24 ` [PATCH v3 0/4] Adjust test for changes in Emacs 27 Jonas Bernoulli
2020-07-27 15:25   ` [PATCH v3 1/4] gitignore: Ignore generated sphinx.config Jonas Bernoulli
2020-07-27 15:25   ` [PATCH v3 2/4] test: Deal with Emacs 27 switching to lexical scope by default Jonas Bernoulli
2020-07-27 15:25   ` Jonas Bernoulli [this message]
2020-07-27 15:25   ` [PATCH v3 4/4] test: Explicitly state that we want to sign with sender Jonas Bernoulli
2020-07-28 11:45   ` [PATCH v3 0/4] Adjust test for changes in Emacs 27 David Bremner
2020-07-29 18:38     ` Jonas Bernoulli

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=20200727152503.15939-4-jonas@bernoul.li \
    --to=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).