branch: externals/hyperbole
commit 917cb2edbba403520d5a0bda76e92e3921317d18
Author: bw <[email protected]>
Commit: bw <[email protected]>
hywiki-tests--filename-same-as-wiki-word - Rewrite to correct tests
Also, apply small fixes from Mats for 2 others tests
---
ChangeLog | 3 +++
hywiki.el | 6 ++++--
test/hywiki-tests.el | 44 +++++++++++++++++++++-----------------------
3 files changed, 28 insertions(+), 25 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 26b24f9d23..de25f5c8df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2026-01-25 Bob Weiner <[email protected]>
+* test/hywiki-tests.el (hywiki-tests--filename-same-as-wiki-word): Rewrote
+ to correct the tests therein.
+
* hywiki.el (hywiki-potential-buffer-p, hywiki-non-hook-context-p): Comment
out 'edebug-active' checks, so can examine same behavior when edebugging.
(hywiki-word-set-auto-highlighting): Fix to ensure all hywiki
diff --git a/hywiki.el b/hywiki.el
index 412471f51a..88f3804586 100644
--- a/hywiki.el
+++ b/hywiki.el
@@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 21-Apr-24 at 22:41:13
-;; Last-Mod: 25-Jan-26 at 12:40:15 by Bob Weiner
+;; Last-Mod: 25-Jan-26 at 16:29:26 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -3589,7 +3589,9 @@ occurs with one of these hooks, the problematic hook is
removed."
;; mode is disabled
(let ((hywiki-mode :all))
(hywiki-word-dehighlight-buffers (hywiki-get-buffers hywiki-mode))))
- ((null hywiki-from-mode)
+ ((or (null hywiki-from-mode)
+ (and (eq hywiki-from-mode :pages) (eq hywiki-to-mode :pages))
+ (and (eq hywiki-from-mode :all) (eq hywiki-to-mode :all)))
(hywiki-word-highlight-buffers (hywiki-get-buffers hywiki-to-mode)))
((and (eq hywiki-from-mode :all) (eq hywiki-to-mode :pages))
(hywiki-word-dehighlight-buffers
diff --git a/test/hywiki-tests.el b/test/hywiki-tests.el
index f4993bd108..34d90c6702 100644
--- a/test/hywiki-tests.el
+++ b/test/hywiki-tests.el
@@ -3,7 +3,7 @@
;; Author: Mats Lidell
;;
;; Orig-Date: 18-May-24 at 23:59:48
-;; Last-Mod: 25-Jan-26 at 11:21:07 by Bob Weiner
+;; Last-Mod: 25-Jan-26 at 19:23:58 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -139,7 +139,7 @@ Last two elements are optional.")
hywiki-tests--edit-string-pairs))
(let ((default-directory hywiki-directory))
(hy-delete-files-and-buffers
- '("AI.org" "Hi.org" "HiHo.org" "HyWiki" "HyWikiW" "HyWikiWord.org"
"MyWikiWord.org" "Non.org" "Wiki")))))))
+ '("AI.org" "Hi.org" "HiHo.org" "HyWiki.org" "HyWikiW.org"
"HyWikiWord.org" "MyWikiWord.org" "Non.org" "Wiki.org")))))))
(defun hywiki-tests--get-brace-strings (s)
"Return the substrings in S delimited by curly braces {…}, excluding braces.
@@ -1845,18 +1845,18 @@ face is verified during the change."
(ert-deftest hywiki-tests--filename-same-as-wiki-word ()
"Regular files should not be WikiWords even when hywiki-mode is active."
(hywiki-tests--preserve-hywiki-mode
- (let ((default-directory hyperb:dir))
+ (let ((default-directory hywiki-directory))
(insert "\"WikiWord\" \"WikiWord.org\"\n")
(goto-char 2)
(should (looking-at-p "WikiWord\" "))
(hywiki-mode nil)
- (should (ibtype:test-p 'pathname))
+ (should-not (ibtype:test-p 'hywiki-existing-word))
(hywiki-mode :all)
- (should (ibtype:test-p 'pathname))
- (goto-char 9)
+ (should (ibtype:test-p 'hywiki-existing-word))
+ (goto-char 13)
;; Verify that using the org extension selects the WikiWord.
(should (looking-at-p "WikiWord\\.org\""))
- (should (ibtype:test-p 'hywiki-existing-word)))))
+ (should (ibtype:test-p 'pathname)))))
(ert-deftest
hywiki-tests--nonexistent-wikiword-with-section-should-create-wikiword ()
"Verify action-key on a new WikiWord#section creates proper page filename."
@@ -1992,22 +1992,20 @@ expected result."
(ert-deftest hywiki-tests--consult-grep ()
"Verify `hywiki-consult-grep' calls `hsys-consult-grep'."
- (let ((hsys-consult-flag nil))
- (unwind-protect
- (progn
- ;; No path list
- (mocklet (((hsys-consult-grep "--include *.org" "--glob *.org"
"regexp" 0 (list hywiki-directory) "prompt") => "match"))
- (should (string= (hywiki-consult-grep "regexp" 0 nil "prompt")
"match")))
- ;; Path list
- (mocklet (((hsys-consult-grep "--include *.org" "--glob *.org"
"regexp" 0 '("path") "prompt") => "match"))
- (should (string= (hywiki-consult-grep "regexp" 0 '("path")
"prompt") "match")))
- ;; No Prompt, max-matches = 0
- (mocklet (((hsys-consult-grep "--include *.org" "--glob *.org"
"regexp" 0 '("path") "Grep HyWiki dir headlines") => "match"))
- (should (string= (hywiki-consult-grep "regexp" 0 '("path"))
"match")))
- ;; No Prompt, max-matches != 0
- (mocklet (((hsys-consult-grep "--include *.org" "--glob *.org"
"regexp" 1 '("path") "Grep HyWiki dir") => "match"))
- (should (string= (hywiki-consult-grep "regexp" 1 '("path"))
"match"))))
- (hywiki-tests--delete-hywiki-dir-and-buffer hywiki-directory))))
+ (hywiki-tests--preserve-hywiki-mode
+ (let ((hsys-consult-flag nil))
+ ;; No path list
+ (mocklet (((hsys-consult-grep "--include *.org" "--glob *.org" "regexp"
0 (list hywiki-directory) "prompt") => "match"))
+ (should (string= (hywiki-consult-grep "regexp" 0 nil "prompt")
"match")))
+ ;; Path list
+ (mocklet (((hsys-consult-grep "--include *.org" "--glob *.org" "regexp"
0 '("path") "prompt") => "match"))
+ (should (string= (hywiki-consult-grep "regexp" 0 '("path") "prompt")
"match")))
+ ;; No Prompt, max-matches = 0
+ (mocklet (((hsys-consult-grep "--include *.org" "--glob *.org" "regexp"
0 '("path") "Grep HyWiki dir headlines") => "match"))
+ (should (string= (hywiki-consult-grep "regexp" 0 '("path")) "match")))
+ ;; No Prompt, max-matches != 0
+ (mocklet (((hsys-consult-grep "--include *.org" "--glob *.org" "regexp"
1 '("path") "Grep HyWiki dir") => "match"))
+ (should (string= (hywiki-consult-grep "regexp" 1 '("path"))
"match"))))))
(ert-deftest hywiki-tests--hywiki-help ()
"Verify `hywiki-help'."