1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-11 09:20:51 +00:00

Make ‘mailcap-viewer-passes-test’ return t for viewers without tests

* lisp/net/mailcap.el (mailcap-viewer-passes-test):
Make ‘mailcap-viewer-passes-test’ follow its docstring and return t
for viewers without a test.  (Bug#65224)
* test/lisp/net/mailcap-tests.el
(mailcap-viewer-passes-test-w/o-test-returns-t): New test.
This commit is contained in:
Felix Dietrich 2023-08-06 06:01:24 +02:00 committed by Stefan Kangas
parent a26f399843
commit 4101464b47
2 changed files with 25 additions and 1 deletions

View File

@ -689,9 +689,9 @@ to supply to the test."
status cache result)
(cond ((not (or (stringp viewer) (fboundp viewer)))
nil) ; Non-existent Lisp function
((null test-info) t) ; No test clause
((setq cache (assoc test mailcap-viewer-test-cache))
(cadr cache))
((not test-info) t) ; No test clause
(t
(setq
result

View File

@ -537,5 +537,29 @@ help to verify the correct addition and merging of an entry."
("minor" . ((viewer . "viewer")
(edit . "edit")))))))))
(ert-deftest mailcap-viewer-passes-test-w/o-test-returns-t ()
"A VIEWER-INFO without a test should return t with a valid viewer (Bug#65224)."
(should (equal t
(let ((mailcap-viewer-test-cache)
(viewer-info
(list (cons 'viewer "viewer-w/o-test"))))
(mailcap-viewer-passes-test viewer-info nil))))
(should (equal '(t t nil t)
(let ((mailcap-viewer-test-cache)
(viewer-infos
(list
(list (cons 'viewer "viewer-w/o-test"))
(list (cons 'viewer "viewer-w/o-test"))
(list (cons 'viewer "viewer-w/nil-test")
(cons 'test nil))
(list (cons 'viewer "viewer-w/o-test"))
)))
(mapcar (lambda (vi)
(mailcap-viewer-passes-test vi nil))
viewer-infos)))))
;;; mailcap-tests.el ends here