branch: externals/hyperbole
commit 4056b90f40c91c3ee63929040a4625645cf1d72c
Author: Mats Lidell <mats.lid...@lidells.se>
Commit: GitHub <nore...@github.com>

    update hsys org link at p test (#768)
---
 ChangeLog              |  2 ++
 test/hsys-org-tests.el | 24 +++++++++++++++++++++---
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c35b286e8b..7304c8b023 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,8 @@
     (kotl-mode--add-after-parent, kotl-mode--add-before-parent)
     (kotl-mode--add-below-parent, kotl-mode--add-child): Add tests.
 
+* test/hsys-org-tests.el (hsys-org:org-link-at-p): Update test.
+
 2025-07-27  Bob Weiner  <r...@gnu.org>
 
 *  hpath.el (hpath:external-file-suffixes): Remove old Sun Raster image format
diff --git a/test/hsys-org-tests.el b/test/hsys-org-tests.el
index 53395e0cca..61c6f8bbcd 100644
--- a/test/hsys-org-tests.el
+++ b/test/hsys-org-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <ma...@gnu.org>
 ;;
 ;; Orig-Date:    23-Apr-21 at 20:55:00
-;; Last-Mod:     11-Jun-25 at 00:20:08 by Mats Lidell
+;; Last-Mod:     31-Jul-25 at 17:32:10 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -66,10 +66,28 @@
 (ert-deftest hsys-org:org-link-at-p ()
   "Should be t if point is within an org-link."
   (with-temp-buffer
+    ;; Org-mode
     (org-mode)
-    (insert "[[Link]]\n")
+    (insert "[[Link]]\n\n")
+    (ert-info ("Within an org link")
+      (goto-char 3)
+      (should (hsys-org-link-at-p)))
+    (ert-info ("At end of line")
+      (end-of-line)
+      (should-not (hsys-org-link-at-p)))
+    (ert-info ("At end of buffer")
+      (end-of-buffer)
+      (should-not (hsys-org-link-at-p)))
+    ;; Out side of org-mode
+    (erase-buffer)
+    (fundamental-mode)
+    (insert "[[hy:HyWiki]]\n\n")
     (goto-char 3)
-    (should (hsys-org-link-at-p))))
+    (ert-info ("Accept link if unknown HyWiki button")
+      (should (hsys-org-link-at-p)))
+    (ert-info ("Ignore link if known HyWiki button")
+      (mocklet (((hywiki-word-at) => t))
+        (should-not (hsys-org-link-at-p))))))
 
 (ert-deftest hsys-org:org-target-at-p ()
   "Should be non nil if point is within an org-radio-target."

Reply via email to