test: add known broken tests for notuch-{before,after}-tag-hook

These tests illustrate the bug reported in id:87v97ytd2s.fsf@fastmail.fm
This commit is contained in:
David Bremner 2021-05-08 09:11:11 -03:00
parent 267365b711
commit a663783343
2 changed files with 27 additions and 0 deletions

View file

@ -161,6 +161,30 @@ test_emacs "(notmuch-show \"$os_x_darwin_thread\")
output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize) 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_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:" test_begin_subtest "Message with .. in Message-Id:"
add_message [id]=123..456@example '[subject]="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\"") test_emacs '(notmuch-search "id:\"123..456@example\"")

View file

@ -99,6 +99,9 @@ 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)))
(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 () (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