From 8664b80c68e9764ef0e4310b4053bf2cb1f41b93 Mon Sep 17 00:00:00 2001 From: Mats Lidell Date: Sun, 28 Sep 2025 18:53:00 +0200 Subject: [PATCH 1/2] Add test for edit of WikiWord in an Emacs Lisp docstring Also update test to verify WikiWord face as well as WikiWord. --- ChangeLog | 6 ++++++ test/hywiki-tests.el | 41 +++++++++++++++++++++++++++++++++++------ 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 43b18c7f..a3d9df60 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2025-10-05 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. + * test/demo-tests.el (fast-demo-outline-section-anchor-and-relative-line-number): Run test using different default major-mode's. diff --git a/test/hywiki-tests.el b/test/hywiki-tests.el index fd0f47ba..f2cd967f 100644 --- a/test/hywiki-tests.el +++ b/test/hywiki-tests.el @@ -1704,11 +1704,39 @@ 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 +t) +") + ;; 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) @@ -1723,14 +1751,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#")) @@ -1739,14 +1767,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 () From 9ce90a9c0bff8b7420786218c8732fbd353e633b Mon Sep 17 00:00:00 2001 From: Mats Lidell Date: Sun, 5 Oct 2025 17:22:49 +0200 Subject: [PATCH 2/2] Removed unused char in test --- test/hywiki-tests.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/hywiki-tests.el b/test/hywiki-tests.el index f2cd967f..a448a4b1 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: 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 ;; @@ -1718,8 +1718,7 @@ face is verified during the change." (emacs-lisp-mode) (insert "\ (defun func () - \"WikiWor -t) + \"WikiWor) ") ;; Set point after WikiWor (goto-char 1)