Skip to content

Commit 51ffb21

Browse files
committed
Add test for edit of WikiWord in an Emacs Lisp docstring
Also update test to verify WikiWord face as well as WikiWord.
1 parent 755ee8a commit 51ffb21

File tree

2 files changed

+43
-6
lines changed

2 files changed

+43
-6
lines changed

ChangeLog

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2025-09-28 Mats Lidell <[email protected]>
2+
3+
* test/hywiki-tests.el
4+
(hywiki-tests--wikiword-step-check-edit-wikiword-in-emacs-lisp-mode):
5+
Add test.
6+
(hywiki-tests--wikiword-identified-in-emacs-lisp-mode): Update test to
7+
verify WikiWord face.
8+
19
2025-09-27 Bob Weiner <[email protected]>
210

311
* hpath.el (hpath:to-markup-anchor): Move 'fundamental-mode' support near

test/hywiki-tests.el

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,11 +1704,39 @@ Insert test in the middle of other text."
17041704
(p1 . t) (p4) (-1 . "Hiho")))))
17051705
(hy-delete-dir-and-buffer hywiki-directory)))))
17061706

1707+
(ert-deftest hywiki-tests--wikiword-step-check-edit-wikiword-in-emacs-lisp-mode ()
1708+
"Run the step check to verify WikiWord is identified under change in a docstring.
1709+
A WikiWord is completed, then last char is deleted and reinserted. The
1710+
face is verified during the change."
1711+
(hywiki-tests--preserve-hywiki-mode
1712+
(let* ((hywiki-directory (make-temp-file "hywiki" t))
1713+
(wiki-page (cdr (hywiki-add-page "WikiWord"))))
1714+
(unwind-protect
1715+
(progn
1716+
(hywiki-mode 1)
1717+
(with-temp-buffer
1718+
(emacs-lisp-mode)
1719+
(insert "\
1720+
(defun func ()
1721+
\"WikiWor
1722+
t)
1723+
")
1724+
;; Set point after WikiWor
1725+
(goto-char 1)
1726+
(should (search-forward "WikiWor"))
1727+
1728+
;; Complete WikiWord and verify highlighting
1729+
(hywiki-tests--run-test-case
1730+
'(("d\"" . "WikiWord") (p2 . t) (-1) ("d" . "WikiWord")))))
1731+
(hy-delete-file-and-buffer wiki-page)
1732+
(hy-delete-dir-and-buffer hywiki-directory)))))
1733+
17071734
(ert-deftest hywiki-tests--wikiword-identified-in-emacs-lisp-mode ()
17081735
"Verify WikiWord is identified when surrounded by delimiters in `emacs-lisp-mode'."
17091736
(hywiki-tests--preserve-hywiki-mode
1710-
(let ((hsys-org-enable-smart-keys t)
1711-
(hywiki-directory (make-temp-file "hywiki" t)))
1737+
(let* ((hsys-org-enable-smart-keys t)
1738+
(hywiki-directory (make-temp-file "hywiki" t))
1739+
(wiki-page (cdr (hywiki-add-page "WikiWord"))))
17121740
(unwind-protect
17131741
(progn
17141742
(hywiki-mode 1)
@@ -1723,14 +1751,14 @@ Insert test in the middle of other text."
17231751
(insert (format ";; %s" v))
17241752
(hywiki-tests--command-execute #'newline 1 'interactive)
17251753
(goto-char 9)
1726-
(should (string= "WikiWord" (hywiki-word-at))))
1754+
(should (string= "WikiWord" (hywiki-tests--word-at))))
17271755

17281756
(with-temp-buffer
17291757
(emacs-lisp-mode)
17301758
(insert (format "(setq var \"%s\")" v))
17311759
(hywiki-tests--command-execute #'newline 1 'interactive)
17321760
(goto-char 16)
1733-
(should (string= "WikiWord" (hywiki-word-at)))))
1761+
(should (string= "WikiWord" (hywiki-tests--word-at)))))
17341762

17351763
;; Does not match as a WikiWord
17361764
(dolist (v '("WikiWord#"))
@@ -1739,14 +1767,15 @@ Insert test in the middle of other text."
17391767
(insert (format ";; %s" v))
17401768
(hywiki-tests--command-execute #'newline 1 'interactive)
17411769
(goto-char 9)
1742-
(should-not (hywiki-word-at)))
1770+
(should-not (hywiki-tests--word-at)))
17431771

17441772
(with-temp-buffer
17451773
(emacs-lisp-mode)
17461774
(insert (format "(setq var \"%s\")" v))
17471775
(hywiki-tests--command-execute #'newline 1 'interactive)
17481776
(goto-char 16)
1749-
(should-not (hywiki-word-at)))))
1777+
(should-not (hywiki-tests--word-at)))))
1778+
(hy-delete-file-and-buffer wiki-page)
17501779
(hy-delete-dir-and-buffer hywiki-directory)))))
17511780

17521781
(ert-deftest hywiki-tests--wikiword-identified-in-strings-in-emacs-lisp-mode ()

0 commit comments

Comments
 (0)