diff --git a/ChangeLog b/ChangeLog index f831433f..8606854b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2025-11-02 Mats Lidell + +* 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 * test/hywiki-tests.el (hywiki-tests--publish-special-cases): Add test diff --git a/test/hywiki-tests.el b/test/hywiki-tests.el index b7e8c584..049f7704 100644 --- a/test/hywiki-tests.el +++ b/test/hywiki-tests.el @@ -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 ;; @@ -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) @@ -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#")) @@ -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 () @@ -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))))