branch: externals/hyperbole
commit be675138e102c96b71842f196eb4f2b0d32baad8
Author: Mats Lidell <[email protected]>
Commit: GitHub <[email protected]>
Add test for hywiki-mode (#839)
---
ChangeLog | 7 +++++++
hywiki.el | 8 ++++----
test/hywiki-tests.el | 20 +++++++++++++++++++-
3 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index cbe0b1c832..c082a0cf91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2026-01-07 Mats Lidell <[email protected]>
+
+* hywiki.el (hywiki-mode): Remove arg value :toggle, not an alternative to
+ 'toggle.
+
+* test/hywiki-tests.el (hywiki-test--hywiki-mode): Add test for hywiki-mode.
+
2025-12-31 Mats Lidell <[email protected]>
* Remove starting asterix from defcustom variable docstrings.
diff --git a/hywiki.el b/hywiki.el
index cc875e9648..81683a803c 100644
--- a/hywiki.el
+++ b/hywiki.el
@@ -3,11 +3,11 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 21-Apr-24 at 22:41:13
-;; Last-Mod: 30-Nov-25 at 18:06:52 by Bob Weiner
+;; Last-Mod: 7-Jan-26 at 15:26:05 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
-;; Copyright (C) 2024-2025 Free Software Foundation, Inc.
+;; Copyright (C) 2024-2026 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
;;
;; This file is part of GNU Hyperbole.
@@ -801,9 +801,9 @@ See the Info documentation at \"(hyperbole)HyWiki\".
:keymap hywiki-mode-map
:group 'hyperbole-hywiki
(progn
- (when (memq arg '(toggle :toggle))
+ (when (eq arg 'toggle)
;; Toggle across all editable buffers
- (setq arg (if hywiki-mode 1 0)))
+ (setq arg hywiki-mode))
(cond
((or (and (integerp arg) (= arg 1))
(memq arg '(:all t)))
diff --git a/test/hywiki-tests.el b/test/hywiki-tests.el
index 4fdfdb1589..86240cf127 100644
--- a/test/hywiki-tests.el
+++ b/test/hywiki-tests.el
@@ -7,7 +7,7 @@
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
-;; Copyright (C) 2024-2025 Free Software Foundation, Inc.
+;; Copyright (C) 2024-2026 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
;;
;; This file is part of GNU Hyperbole.
@@ -2141,6 +2141,24 @@ expected result."
(hy-delete-files-and-buffers (list wikiHi wikiHo))
(hywiki-tests--delete-hywiki-dir-and-buffer hywiki-directory)))))
+(ert-deftest hywiki-test--hywiki-mode ()
+ "Verify activating local and global `hywiki-mode'."
+ (hywiki-tests--preserve-hywiki-mode
+ (with-temp-buffer
+ (should (eq nil (hywiki-mode 0)))
+ (should (eq nil (hywiki-mode -1)))
+ (should (eq nil (hywiki-mode nil)))
+ (should (eq :pages (hywiki-mode 2)))
+ (should (eq :all (hywiki-mode 1)))
+ (should (eq :all (hywiki-mode t)))
+ (should (eq :all (hywiki-mode :all)))
+
+ ;; Toggle
+ (should (eq nil (call-interactively #'hywiki-mode)))
+ (should (eq :all (call-interactively #'hywiki-mode)))
+ (should (eq nil (hywiki-mode 'toggle)))
+ (should (eq :all (hywiki-mode 'toggle))))))
+
(ert-deftest hywiki-tests--interactive-hywiki-mode-toggles ()
"Verify `hywiki-mode' called interactively toggles mode."
(hywiki-tests--preserve-hywiki-mode