branch: externals/hyperbole
commit 0690bfe25e9523092911de04a0631e85793f17f3
Author: Mats Lidell <mats.lid...@lidells.se>
Commit: Mats Lidell <mats.lid...@lidells.se>

    Add test for new WikiWord with initially provided section
---
 ChangeLog            |  2 ++
 test/hywiki-tests.el | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 45138c7791..9d9bbb1497 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,8 @@
     (hywiki-tests--action-key-moves-to-word-and-section):
     (hywiki-tests--at-wikiword-finds-word-and-section): Use commented out
     test. It is supported now.
+    (hywiki-tests--nonexistent-wikiword-with-section-should-create-wikiword):
+    Add test for a new WikiWord when initially given with a section.
 
 2025-05-26  Bob Weiner  <r...@gnu.org>
 
diff --git a/test/hywiki-tests.el b/test/hywiki-tests.el
index 54ad4812a9..1b973ee1f8 100644
--- a/test/hywiki-tests.el
+++ b/test/hywiki-tests.el
@@ -1534,6 +1534,25 @@ Insert test in the middle of other text."
         (hy-delete-file-and-buffer wiki-page)
         (hy-delete-dir-and-buffer hywiki-directory)))))
 
+(ert-deftest 
hywiki-tests--nonexistent-wikiword-with-section-should-create-wikiword ()
+  "Verify that action-key on a new WikiWord with section only creates 
WikiWord.org.
+Bug - creates WikiWord.org#section"
+  :expected-result :failed
+  (hywiki-tests--preserve-hywiki-mode
+    (let* ((hywiki-directory (make-temp-file "hywiki" t))
+           (hywiki-page (expand-file-name "WikiWord.org" hywiki-directory))
+           (hywiki-page-with-section (expand-file-name "WikiWord.org#section" 
hywiki-directory)))
+      (unwind-protect
+          (with-temp-buffer
+            (hywiki-mode 1)
+            (insert "WikiWord#section")
+            (goto-char 4)
+            (action-key)
+            (should-not (file-exists-p hywiki-page-with-section))
+            (should (file-exists-p hywiki-page)))
+        (hy-delete-files-and-buffers (list hywiki-page 
hywiki-page-with-section))
+        (hy-delete-dir-and-buffer hywiki-directory)))))
+
 (provide 'hywiki-tests)
 
 ;; This file can't be byte-compiled without the `el-mock' package

Reply via email to