Hi everyone, I have added characterization tests to go with the refactoring patch I sent yesterday: '[PATCH] lisp/org-colview.el: Refactor conflicting minor modes management'. They act as a safety net to ensure that the observable behavior remains unchanged.
They exercise the public API only (org-columns, org-columns-quit) and document the contract that column view temporarily turns off flyspell-mode and org-num-mode on entry, then restores their original state on exit. Because these tests do not reference the new internal helpers introduced in yesterday's patch, they are valid both before and after the refactor. Please let me know what you think. The test suite passes locally. Please apply this patch first. Best, -- Slawomir Grochowski
>From ebbffe101b989b5d76dd07c89747665be375c19e Mon Sep 17 00:00:00 2001 From: Slawomir Grochowski <[email protected]> Date: Mon, 4 May 2026 20:09:54 +0200 Subject: [PATCH] testing/lisp/test-org-colview.el: Pin behavior of conflicting minor modes * testing/lisp/test-org-colview.el (test-org-colview/org-columns-suspends-conflicting-modes): New test. (test-org-colview/org-columns-quit-restores-conflicting-modes): New test. Characterization tests written before the upcoming refactor. They exercise the public API only (`org-columns', `org-columns-quit') and document the contract that column view temporarily turns off `flyspell-mode' and `org-num-mode' on entry, then restores their original state on exit. The tests act as a safety net for the next commit, "Refactor conflicting minor modes management", which extracts the inlined suspend/resume logic into dedicated helpers. Because they do not reference the new helpers, they are valid both before and after the refactor and prove that observable behavior is preserved. --- testing/lisp/test-org-colview.el | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/testing/lisp/test-org-colview.el b/testing/lisp/test-org-colview.el index bbf14d0d4..04dfaba22 100644 --- a/testing/lisp/test-org-colview.el +++ b/testing/lisp/test-org-colview.el @@ -1823,5 +1823,30 @@ there are 4 parameters (org-columns) (get-char-property (point) 'org-columns-value)))))) +(ert-deftest test-org-colview/org-columns-suspends-conflicting-modes () + "`org-columns' turns off `flyspell-mode' / `org-num-mode' while active." + (dolist (mode '(flyspell-mode org-num-mode)) + (cl-letf (((symbol-function mode) + (lambda (&optional arg) + (set (make-local-variable mode) + (and (numberp arg) (> arg 0)))))) + (org-test-with-temp-text "* H" + (funcall mode 1) + (let ((org-columns-default-format "%ITEM")) (org-columns)) + (should-not (symbol-value mode)))))) + +(ert-deftest test-org-colview/org-columns-quit-restores-conflicting-modes () + "`org-columns-quit' re-enables modes that were on before `org-columns'." + (dolist (mode '(flyspell-mode org-num-mode)) + (cl-letf (((symbol-function mode) + (lambda (&optional arg) + (set (make-local-variable mode) + (and (numberp arg) (> arg 0)))))) + (org-test-with-temp-text "* H" + (funcall mode 1) + (let ((org-columns-default-format "%ITEM")) (org-columns)) + (org-columns-quit) + (should (symbol-value mode)))))) + (provide 'test-org-colview) ;;; test-org-colview.el ends here -- 2.39.5
