mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 04:18:08 +01:00
emacs: Do not abuse advice to monkey patch while testing
Use `cl-letf*' instead.
This commit is contained in:
parent
96baa22318
commit
3665914f71
2 changed files with 8 additions and 14 deletions
|
@ -40,12 +40,14 @@ test_emacs '(notmuch-search "tag:inbox")
|
||||||
test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox OUTPUT
|
test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox OUTPUT
|
||||||
|
|
||||||
test_begin_subtest "Incremental parsing of search results"
|
test_begin_subtest "Incremental parsing of search results"
|
||||||
test_emacs "(ad-enable-advice 'notmuch-search-process-filter 'around 'pessimal)
|
test_emacs "(cl-letf* (((symbol-function 'orig)
|
||||||
(ad-activate 'notmuch-search-process-filter)
|
(symbol-function 'notmuch-search-process-filter))
|
||||||
(notmuch-search \"tag:inbox\")
|
((symbol-function 'notmuch-search-process-filter)
|
||||||
(notmuch-test-wait)
|
(lambda (proc string)
|
||||||
(ad-disable-advice 'notmuch-search-process-filter 'around 'pessimal)
|
(cl-loop for char across string
|
||||||
(ad-activate 'notmuch-search-process-filter)
|
do (orig proc (char-to-string char))))))
|
||||||
|
(notmuch-search \"tag:inbox\")
|
||||||
|
(notmuch-test-wait))
|
||||||
(test-output)"
|
(test-output)"
|
||||||
test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox OUTPUT
|
test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox OUTPUT
|
||||||
|
|
||||||
|
|
|
@ -97,14 +97,6 @@ running, quit if it terminated."
|
||||||
(add-hook 'notmuch-hello-refresh-hook
|
(add-hook 'notmuch-hello-refresh-hook
|
||||||
(lambda () (cl-incf notmuch-hello-refresh-hook-counter)))
|
(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."
|
|
||||||
(let ((string (ad-get-arg 1)))
|
|
||||||
(cl-loop for char across string
|
|
||||||
do (progn
|
|
||||||
(ad-set-arg 1 (char-to-string char))
|
|
||||||
ad-do-it))))
|
|
||||||
|
|
||||||
(defun notmuch-test-mark-links ()
|
(defun notmuch-test-mark-links ()
|
||||||
"Enclose links in the current buffer with << and >>."
|
"Enclose links in the current buffer with << and >>."
|
||||||
;; Links are often created by jit-lock functions
|
;; Links are often created by jit-lock functions
|
||||||
|
|
Loading…
Reference in a new issue