Skip to content
Merged
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
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2025-11-02 Mats Lidell <matsl@gnu.org>

* 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.

2025-10-31 Mats Lidell <matsl@gnu.org>

* test/hywiki-tests.el (hywiki-tests--publish-special-cases): Add test
Expand Down
44 changes: 36 additions & 8 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: 31-Oct-25 at 22:37:45 by Mats Lidell
;; Last-Mod: 2-Nov-25 at 18:54:18 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -1812,11 +1812,38 @@ Insert test in the middle of other text."
(p1 . t) (p4) (-1 . "Hiho")))))
(hywiki-tests--delete-hywiki-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)
(hywiki-tests--delete-hywiki-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 @@ -1831,14 +1858,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 @@ -1847,14 +1874,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)
(hywiki-tests--delete-hywiki-dir-and-buffer hywiki-directory)))))

(ert-deftest hywiki-tests--wikiword-identified-in-strings-in-emacs-lisp-mode ()
Expand Down Expand Up @@ -2082,7 +2110,7 @@ Insert test in the middle of other text."
(wikiHi (cdr (hywiki-add-page "Hi")))
(action-key-modeline-buffer-id-function nil)) ; Avoid treemacs.
(unwind-protect
(progn
(progn
(hywiki-directory-edit)
(should (equal 'dired-mode major-mode))
(should (string= default-directory (file-name-as-directory hywiki-directory))))
Expand Down