summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2020-11-01 15:00:36 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2020-11-01 15:00:44 +0100
commit2a4b0da28c3d25f2eea17c9dc95f7a244bdf4535 (patch)
tree64edec589c630abdceb2061996094361c1e971b0 /test/lisp/emacs-lisp
parentecec9a259b13d88fa23dde078fba99ae78ef79c7 (diff)
downloademacs-2a4b0da28c3d25f2eea17c9dc95f7a244bdf4535.tar.gz
emacs-2a4b0da28c3d25f2eea17c9dc95f7a244bdf4535.tar.bz2
emacs-2a4b0da28c3d25f2eea17c9dc95f7a244bdf4535.zip
Make minor mode ARG work as documented
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring): Clarify when minor modes are switched on/off when called from lisp (bug#44341). (define-minor-mode): Make calls from Lisp switch the mode on/off as documented.
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r--test/lisp/emacs-lisp/easy-mmode-tests.el21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/easy-mmode-tests.el b/test/lisp/emacs-lisp/easy-mmode-tests.el
index 4d7fe9444fb..4a448200a2b 100644
--- a/test/lisp/emacs-lisp/easy-mmode-tests.el
+++ b/test/lisp/emacs-lisp/easy-mmode-tests.el
@@ -44,6 +44,27 @@
'(c-mode (not message-mode mail-mode) text-mode))
t))))
+(ert-deftest easy-mmode--minor-mode ()
+ (with-temp-buffer
+ (define-minor-mode test-mode "A test.")
+ (should (eq test-mode nil))
+ (test-mode t)
+ (should (eq test-mode nil))
+ (test-mode nil)
+ (should (eq test-mode t))
+ (test-mode -33)
+ (should (eq test-mode nil))
+ (test-mode 33)
+ (should (eq test-mode t))
+ (test-mode 0)
+ (should (eq test-mode nil))
+ (test-mode 'toggle)
+ (should (eq test-mode t))
+ (test-mode 'toggle)
+ (should (eq test-mode nil))
+ (test-mode "what")
+ (should (eq test-mode nil))))
+
(provide 'easy-mmode-tests)
;;; easy-mmode-tests.el ends here