From 318044608dedd94dd69550c0365036935480554c Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 5 May 2026 14:51:22 -0500 Subject: test: cover present-simple-card-with-typed-answer I added a test for `org-drill-present-simple-card-with-typed-answer' that mocks `prompt-for-string' and the surrounding hide-* helpers, then asserts the presenter forwards the session and returns the prompt's result. Coverage moved from 94.4% to 94.8%. --- tests/test-org-drill-presentation-prompt.el | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') diff --git a/tests/test-org-drill-presentation-prompt.el b/tests/test-org-drill-presentation-prompt.el index 2c81623..e330cbf 100644 --- a/tests/test-org-drill-presentation-prompt.el +++ b/tests/test-org-drill-presentation-prompt.el @@ -181,6 +181,24 @@ mentions the response keys." (let ((result (org-drill-presentation-prompt-in-buffer session "p"))) (should (eq 'mock-result result)))))))) +;;;; org-drill-present-simple-card-with-typed-answer + +(ert-deftest test-present-simple-card-with-typed-answer-runs-prompt () + "The typed-answer presenter calls `prompt-for-string' and returns its value." + (let ((called-with nil)) + (cl-letf (((symbol-function 'org-drill-hide-all-subheadings-except) #'ignore) + ((symbol-function 'org-drill--show-latex-fragments) #'ignore) + ((symbol-function 'org-display-inline-images) #'ignore) + ((symbol-function 'org-drill-hide-drawers) #'ignore) + ((symbol-function 'org-drill-hide-subheadings-if) #'ignore) + ((symbol-function 'org-drill-presentation-prompt-for-string) + (lambda (s _p) (setq called-with s) 'prompt-result))) + (with-fresh-drill-entry + (let* ((session (org-drill-session)) + (result (org-drill-present-simple-card-with-typed-answer session))) + (should (eq 'prompt-result result)) + (should (eq session called-with))))))) + (provide 'test-org-drill-presentation-prompt) ;;; test-org-drill-presentation-prompt.el ends here -- cgit v1.2.3