Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
2025-10-05 Mats Lidell <[email protected]>

* test/hywiki-tests.el
(hywiki-tests--wikiword-step-check-edit-wikiword-in-emacs-lisp-mode):
Add test.
(hywiki-tests--wikiword-identified-in-emacs-lisp-mode): Update test to
verify WikiWord face.

* test/demo-tests.el (fast-demo-outline-section-anchor-and-relative-line-number):
Run test using different default major-mode's.

Expand Down
42 changes: 35 additions & 7 deletions test/hywiki-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Mats Lidell
;;
;; Orig-Date: 18-May-24 at 23:59:48
;; Last-Mod: 7-Sep-25 at 18:51:42 by Bob Weiner
;; Last-Mod: 5-Oct-25 at 17:18:29 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -1704,11 +1704,38 @@ Insert test in the middle of other text."
(p1 . t) (p4) (-1 . "Hiho")))))
(hy-delete-dir-and-buffer hywiki-directory)))))

(ert-deftest hywiki-tests--wikiword-step-check-edit-wikiword-in-emacs-lisp-mode ()
"Run the step check to verify WikiWord is identified under change in a docstring.
A WikiWord is completed, then last char is deleted and reinserted. The
face is verified during the change."
(hywiki-tests--preserve-hywiki-mode
(let* ((hywiki-directory (make-temp-file "hywiki" t))
(wiki-page (cdr (hywiki-add-page "WikiWord"))))
(unwind-protect
(progn
(hywiki-mode 1)
(with-temp-buffer
(emacs-lisp-mode)
(insert "\
(defun func ()
\"WikiWor)
")
;; Set point after WikiWor
(goto-char 1)
(should (search-forward "WikiWor"))

;; Complete WikiWord and verify highlighting
(hywiki-tests--run-test-case
'(("d\"" . "WikiWord") (p2 . t) (-1) ("d" . "WikiWord")))))
(hy-delete-file-and-buffer wiki-page)
(hy-delete-dir-and-buffer hywiki-directory)))))

(ert-deftest hywiki-tests--wikiword-identified-in-emacs-lisp-mode ()
"Verify WikiWord is identified when surrounded by delimiters in `emacs-lisp-mode'."
(hywiki-tests--preserve-hywiki-mode
(let ((hsys-org-enable-smart-keys t)
(hywiki-directory (make-temp-file "hywiki" t)))
(let* ((hsys-org-enable-smart-keys t)
(hywiki-directory (make-temp-file "hywiki" t))
(wiki-page (cdr (hywiki-add-page "WikiWord"))))
(unwind-protect
(progn
(hywiki-mode 1)
Expand All @@ -1723,14 +1750,14 @@ Insert test in the middle of other text."
(insert (format ";; %s" v))
(hywiki-tests--command-execute #'newline 1 'interactive)
(goto-char 9)
(should (string= "WikiWord" (hywiki-word-at))))
(should (string= "WikiWord" (hywiki-tests--word-at))))

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

;; Does not match as a WikiWord
(dolist (v '("WikiWord#"))
Expand All @@ -1739,14 +1766,15 @@ Insert test in the middle of other text."
(insert (format ";; %s" v))
(hywiki-tests--command-execute #'newline 1 'interactive)
(goto-char 9)
(should-not (hywiki-word-at)))
(should-not (hywiki-tests--word-at)))

(with-temp-buffer
(emacs-lisp-mode)
(insert (format "(setq var \"%s\")" v))
(hywiki-tests--command-execute #'newline 1 'interactive)
(goto-char 16)
(should-not (hywiki-word-at)))))
(should-not (hywiki-tests--word-at)))))
(hy-delete-file-and-buffer wiki-page)
(hy-delete-dir-and-buffer hywiki-directory)))))

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