GNU bug report logs - #76372
31.0.50; False () in ert-font-lock macro signatures

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: "Basil L. Contovounesios" <basil@HIDDEN>; dated Mon, 17 Feb 2025 20:38:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug Marked as found in versions 30.0.93. Request was from "Basil L. Contovounesios" <basil@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 76372 <at> debbugs.gnu.org:


Received: (at 76372) by debbugs.gnu.org; 20 Feb 2025 09:53:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 20 04:53:49 2025
Received: from localhost ([127.0.0.1]:60313 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tl3Fb-0005rz-4H
	for submit <at> debbugs.gnu.org; Thu, 20 Feb 2025 04:53:49 -0500
Received: from mta-08-4.privateemail.com ([198.54.122.147]:35054)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <basil@HIDDEN>)
 id 1tl3FX-0005r2-0N; Thu, 20 Feb 2025 04:53:44 -0500
Received: from mta-08.privateemail.com (localhost [127.0.0.1])
 by mta-08.privateemail.com (Postfix) with ESMTP id 4Yz7r031k1z3hhW8;
 Thu, 20 Feb 2025 04:53:36 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=contovou.net;
 s=default; t=1740045216;
 bh=cV/7heogKTANclV4TEMQiM785vjzthkIpzbY7RenVWE=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=TNj6kLyNy99YFSf8zk1qq7sTHFB34UPriM2R1/DF/yUX152CcNpZkcmoPzPq2ahPS
 xRu0Sbe9789OJYayu/Umtj7xSQCtaYUGsNaFaGP/TX/Q+k5N+VJxyOiCPALUPkFpMe
 YnezjAcVKgbIWs820EWEHQXaVAI+TreahPtIuzkOZoquLecFcf7KAKQnO2NmzRRolI
 N5SQr1Q9Vo5a5/ZYQLzBhwTa8U7ddBm7pfcJgHyCwnhKvjV92T1G7+ak8qGvKZ5ed8
 xKaL4Tk49EddJkU8RkxNkecID1gb1jIw5CIijv86kUg1X5Cn32+37MC56ljWeClXJc
 1kJfsTBdQYRlg==
Received: from localhost (unknown [31.46.242.24])
 by mta-08.privateemail.com (Postfix) with ESMTPA;
 Thu, 20 Feb 2025 04:53:33 -0500 (EST)
From: "Basil L. Contovounesios" <basil@HIDDEN>
To: Vladimir Kazanov <vekazanov@HIDDEN>
Subject: Re: bug#76372: 31.0.50; False () in ert-font-lock macro signatures
In-Reply-To: <CAAs=0-0WhQLfkpijsc0BkNKK0ZU4auT6+=CeZK4uFJs1Y4XoWg@HIDDEN>
References: <87pljgcnpp.fsf@HIDDEN>
 <CAAs=0-1iJpQg3OW4dDaYGh0G-rfBGSfF5_ROtX_Z4tUs6S3JUw@HIDDEN>
 <87eczt6689.fsf@HIDDEN>
 <CAAs=0-0WhQLfkpijsc0BkNKK0ZU4auT6+=CeZK4uFJs1Y4XoWg@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
Date: Thu, 20 Feb 2025 10:53:28 +0100
Message-ID: <87msehvt5z.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Virus-Scanned: ClamAV using ClamSMTP
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 76372
Cc: 76372 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

found 76372 30.0.93
quit

Vladimir Kazanov [2025-02-20 08:23 +0000] wrote:

> Feel free to push,

I was about to, but then it occurred to me that ert-font-lock is new in
Emacs 30.

Perhaps the docstring fixes at least should go to emacs-30 instead of
master?

If Eli/Stefan/Andrea agree, I propose the first patch for emacs-30, and
the second for master (they just separate the documentation/test changes
from those to code).

To recap, the main issue in this report is that the arglist of
ert-font-lock-deftest and ert-font-lock-deftest-file is misrepresented
in their documentation and declare specs, which can lead to minor
confusion, misindentation, and misfontification.

> Thanks for looking into this!

Thank *you* for the neat feature and review!
-- 
Basil


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Fix-ert-font-lock-macro-signatures.patch

From ea2b2e3612e026129d9cf043d7e2444981084605 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <basil@HIDDEN>
Date: Thu, 20 Feb 2025 10:29:54 +0100
Subject: [PATCH 1/2] Fix ert-font-lock macro signatures

* doc/misc/ert.texi (Syntax Highlighting Tests):
* test/lisp/emacs-lisp/ert-font-lock-tests.el
(test-line-comment-p--emacs-lisp, test-line-comment-p--shell-script)
(test-line-comment-p--javascript, test-line-comment-p--python)
(test-line-comment-p--c, test-macro-test--correct-highlighting)
(test-macro-test--docstring, test-macro-test--failing)
(test-macro-test--file, test-macro-test--file-no-asserts)
(test-macro-test--file-failing): Reindent macro calls.
(with-temp-buffer-str-mode): Evaluate macro arguments left-to-right.
(ert-font-lock--wrap-begin-end): Use rx for more robust composition.
(test-line-comment-p--php): Require that php-mode is callable, not
already loaded.

* lisp/emacs-lisp/ert-font-lock.el (ert-font-lock-deftest)
(ert-font-lock-deftest-file): NAME is not followed by an empty list
like in ert-deftest, so the optional DOCSTRING is actually the
second argument.  Adapt calling convention in docstring, and debug,
doc-string, and indent properties accordingly (bug#76372).  Fix
docstring grammar, document MAJOR-MODE, and avoid referring to a
file name as a path.
---
 doc/misc/ert.texi                           | 10 +--
 lisp/emacs-lisp/ert-font-lock.el            | 39 +++++----
 test/lisp/emacs-lisp/ert-font-lock-tests.el | 94 ++++++++++-----------
 3 files changed, 73 insertions(+), 70 deletions(-)

diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi
index 566fa03bf3f..8f9e4fff415 100644
--- a/doc/misc/ert.texi
+++ b/doc/misc/ert.texi
@@ -962,7 +962,7 @@ Syntax Highlighting Tests
 comments directly and can be read either from inline strings or files.
 The parser expects the input string to contain at least one assertion.
 
-Test assertion parser extracts tests from comment-only lines.  Every
+The test assertion parser extracts tests from comment-only lines.  Every
 comment assertion line starts either with a caret (@samp{^}) or an arrow
 (@samp{<-}).  A single caret/arrow or carets should be followed
 immediately by the name of a face or a list of faces to be checked
@@ -984,7 +984,7 @@ Syntax Highlighting Tests
 @end example
 
 Both symbol-only @code{:face} property values and assertion face values
-are normalized to single element lists so assertions below are
+are normalized to single element lists so the assertions below are
 equivalent:
 
 @example
@@ -1061,7 +1061,7 @@ Syntax Highlighting Tests
 
 @lisp
 (ert-font-lock-deftest test-macro-test--inline
-    emacs-lisp-mode
+  emacs-lisp-mode
   "
 (defun fun ())
 ;; ^ font-lock-keyword-face
@@ -1075,13 +1075,13 @@ Syntax Highlighting Tests
 
 @lisp
 (ert-font-lock-deftest-file test-macro-test--file
-    "Test reading correct assertions from a file"
+  "Test reading correct assertions from a file."
   javascript-mode
   "correct.js")
 @end lisp
 
 The @code{ert-font-lock-deftest} and @code{ert-font-lock-deftest-file}
-macros accept the same keyword parameters as @code{ert-deftest} i.e.,
+macros accept the same keyword arguments as @code{ert-deftest}, i.e.,
 @code{:tag} and @code{:expected-result}.
 
 
diff --git a/lisp/emacs-lisp/ert-font-lock.el b/lisp/emacs-lisp/ert-font-lock.el
index e584eb679fd..80f4a6d5467 100644
--- a/lisp/emacs-lisp/ert-font-lock.el
+++ b/lisp/emacs-lisp/ert-font-lock.el
@@ -27,8 +27,8 @@
 ;; highlighting provided by font-lock.
 ;;
 ;; ert-font-lock entry points are functions
-;; `ert-font-lock-test-string' and `ert-font-lock-test-file' and
-;; convenience macros: `ert-font-lock-deftest' and
+;; `ert-font-lock-test-string' and `ert-font-lock-test-file', and
+;; convenience macros `ert-font-lock-deftest' and
 ;; `ert-font-lock-deftest-file'.
 ;;
 ;; See unit tests in ert-font-lock-tests.el for usage examples.
@@ -124,19 +124,21 @@ ert-font-lock--parse-macro-args
 (defmacro ert-font-lock-deftest (name &rest docstring-keys-mode-and-str)
   "Define test NAME (a symbol) using assertions from TEST-STR.
 
-Other than MAJOR-MODE and TEST-STR parameters, this macro accepts
-the same parameters and keywords as `ert-deftest' and is intended
-to be used through `ert'.
+The MAJOR-MODE symbol determines the syntax and font lock of TEST-STR.
 
-\(fn NAME () [DOCSTRING] [:expected-result RESULT-TYPE] \
+Except for the MAJOR-MODE and TEST-STR parameters, this macro accepts
+the same arguments and keywords as `ert-deftest' and is intended to be
+used through `ert'.
+
+\(fn NAME [DOCSTRING] [:expected-result RESULT-TYPE] \
 [:tags \\='(TAG...)] MAJOR-MODE TEST-STR)"
   (declare (debug (&define [&name "test@" symbolp]
-                           sexp [&optional stringp]
+                           [&optional stringp]
                            [&rest keywordp sexp]
                            symbolp
                            stringp))
-           (doc-string 3)
-           (indent 2))
+           (doc-string 2)
+           (indent 1))
   (pcase-let ((`(,documentation
                  ,documentation-supplied-p
                  ,keys ,mode ,arg)
@@ -159,22 +161,23 @@ ert-font-lock-deftest
 (defmacro ert-font-lock-deftest-file (name &rest docstring-keys-mode-and-file)
   "Define test NAME (a symbol) using assertions from FILE.
 
-FILE - path to a file with assertions in ERT resource director as
-return by `ert-resource-directory'.
+FILE names a file with assertions in the ERT resource directory, as
+returned by `ert-resource-directory'.  The MAJOR-MODE symbol determines
+the syntax and font lock of FILE's contents.
 
-Other than MAJOR-MODE and FILE parameters, this macro accepts the
-same parameters and keywords as `ert-deftest' and is intended to
-be used through `ert'.
+Except for the MAJOR-MODE and FILE parameters, this macro accepts the
+same arguments and keywords as `ert-deftest' and is intended to be used
+through `ert'.
 
-\(fn NAME () [DOCSTRING] [:expected-result RESULT-TYPE] \
+\(fn NAME [DOCSTRING] [:expected-result RESULT-TYPE] \
 [:tags \\='(TAG...)] MAJOR-MODE FILE)"
   (declare (debug (&define [&name "test@" symbolp]
-                           sexp [&optional stringp]
+                           [&optional stringp]
                            [&rest keywordp sexp]
                            symbolp
                            stringp))
-           (doc-string 3)
-           (indent 2))
+           (doc-string 2)
+           (indent 1))
 
   (pcase-let ((`(,documentation
                  ,documentation-supplied-p
diff --git a/test/lisp/emacs-lisp/ert-font-lock-tests.el b/test/lisp/emacs-lisp/ert-font-lock-tests.el
index e410cf5fa13..0c3e4405562 100644
--- a/test/lisp/emacs-lisp/ert-font-lock-tests.el
+++ b/test/lisp/emacs-lisp/ert-font-lock-tests.el
@@ -39,13 +39,13 @@ with-temp-buffer-str-mode
   "Create a buffer with STR contents and MODE. "
   (declare (indent 1) (debug t))
   `(with-temp-buffer
-     (insert ,str)
      (,mode)
+     (insert ,str)
      (goto-char (point-min))
      ,@body))
 
 (defun ert-font-lock--wrap-begin-end (re)
-  (concat "^" re "$"))
+  (rx bol (regexp re) eol))
 
 ;;; Regexp tests
 ;;;
@@ -97,89 +97,89 @@ test-line-comment-p--fundamental
 
 (ert-deftest test-line-comment-p--emacs-lisp ()
   (with-temp-buffer-str-mode emacs-lisp-mode
-                             "not comment
+    "not comment
 ;; comment
 "
-                             (should-not (ert-font-lock--line-comment-p))
-                             (forward-line)
-                             (should (ert-font-lock--line-comment-p))
-                             (forward-line)
-                             (should-not (ert-font-lock--line-comment-p))))
+    (should-not (ert-font-lock--line-comment-p))
+    (forward-line)
+    (should (ert-font-lock--line-comment-p))
+    (forward-line)
+    (should-not (ert-font-lock--line-comment-p))))
 
 (ert-deftest test-line-comment-p--shell-script ()
   (with-temp-buffer-str-mode shell-script-mode
-                             "echo Not a comment
+    "echo Not a comment
 # comment
 "
-                             (should-not (ert-font-lock--line-comment-p))
-                             (forward-line)
-                             (should (ert-font-lock--line-comment-p))))
+    (should-not (ert-font-lock--line-comment-p))
+    (forward-line)
+    (should (ert-font-lock--line-comment-p))))
 
 (declare-function php-mode "php-mode")
 (ert-deftest test-line-comment-p--php ()
-  (skip-unless (featurep 'php-mode))
+  (skip-unless (fboundp 'php-mode))
 
   (with-temp-buffer-str-mode php-mode
-                             "echo 'Not a comment'
+    "echo 'Not a comment'
 // comment
 /* comment */
 "
-                             (should-not (ert-font-lock--line-comment-p))
-                             (forward-line)
-                             (should (ert-font-lock--line-comment-p))
-                             (forward-line)
-                             (should (ert-font-lock--line-comment-p))))
+    (should-not (ert-font-lock--line-comment-p))
+    (forward-line)
+    (should (ert-font-lock--line-comment-p))
+    (forward-line)
+    (should (ert-font-lock--line-comment-p))))
 
 
 (ert-deftest test-line-comment-p--javascript ()
   (with-temp-buffer-str-mode javascript-mode
-                             "// comment
+    "// comment
 
    // comment, after a blank line
 
 var abc = function(d) {};
 "
-                             (should (ert-font-lock--line-comment-p))
+    (should (ert-font-lock--line-comment-p))
 
-                             (forward-line)
-                             (should-not (ert-font-lock--line-comment-p))
+    (forward-line)
+    (should-not (ert-font-lock--line-comment-p))
 
-                             (forward-line)
-                             (should (ert-font-lock--line-comment-p))
+    (forward-line)
+    (should (ert-font-lock--line-comment-p))
 
-                             (forward-line)
-                             (should-not (ert-font-lock--line-comment-p))
+    (forward-line)
+    (should-not (ert-font-lock--line-comment-p))
 
-                             (forward-line)
-                             (should-not (ert-font-lock--line-comment-p))))
+    (forward-line)
+    (should-not (ert-font-lock--line-comment-p))))
 
 (ert-deftest test-line-comment-p--python ()
 
   (with-temp-buffer-str-mode python-mode
-                             "# comment
+    "# comment
 
    # comment
 print(\"Hello, world!\")"
-                             (should (ert-font-lock--line-comment-p))
+    (should (ert-font-lock--line-comment-p))
 
-                             (forward-line)
-                             (should-not (ert-font-lock--line-comment-p))
+    (forward-line)
+    (should-not (ert-font-lock--line-comment-p))
 
-                             (forward-line)
-                             (should (ert-font-lock--line-comment-p))
+    (forward-line)
+    (should (ert-font-lock--line-comment-p))
 
-                             (forward-line)
-                             (should-not (ert-font-lock--line-comment-p))))
+    (forward-line)
+    (should-not (ert-font-lock--line-comment-p))))
 
 (ert-deftest test-line-comment-p--c ()
 
   (with-temp-buffer-str-mode c-mode
-                             "// comment
+    "// comment
 /* also comment */"
-                             (should (ert-font-lock--line-comment-p))
+    (should (ert-font-lock--line-comment-p))
 
-                             (forward-line)
-                             (should (ert-font-lock--line-comment-p))))
+    (forward-line)
+    (should (ert-font-lock--line-comment-p))))
 
 (ert-deftest test-parse-comments--no-assertion-error ()
   (let* ((str "
@@ -568,14 +568,14 @@ test-font-lock-test-file--wrong
 ;;
 
 (ert-font-lock-deftest test-macro-test--correct-highlighting
-    emacs-lisp-mode
+  emacs-lisp-mode
   "
 (defun fun ())
 ;; ^ font-lock-keyword-face
 ;;      ^ font-lock-function-name-face")
 
 (ert-font-lock-deftest test-macro-test--docstring
-    "A test with a docstring."
+  "A test with a docstring."
   emacs-lisp-mode
   "
 (defun fun ())
@@ -583,7 +583,7 @@ fun
   )
 
 (ert-font-lock-deftest test-macro-test--failing
-    "A failing test."
+  "A failing test."
   :expected-result :failed
   emacs-lisp-mode
   "
@@ -591,18 +591,18 @@ fun
 ;; ^ wrong-face")
 
 (ert-font-lock-deftest-file test-macro-test--file
-    "Test reading correct assertions from a file"
+  "Test reading correct assertions from a file."
   javascript-mode
   "correct.js")
 
 (ert-font-lock-deftest-file test-macro-test--file-no-asserts
-    "Check failing on files without assertions"
+  "Check failing on files without assertions."
   :expected-result :failed
   javascript-mode
   "no-asserts.js")
 
 (ert-font-lock-deftest-file test-macro-test--file-failing
-    "Test reading wrong assertions from a file"
+  "Test reading wrong assertions from a file."
   :expected-result :failed
   javascript-mode
   "broken.js")
-- 
2.47.2


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0002-Clean-up-ert-font-lock-error-messages.patch

From e53bcc902db2223045f518facf8d95ac102bfb56 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <basil@HIDDEN>
Date: Thu, 20 Feb 2025 10:34:00 +0100
Subject: [PATCH 2/2] Clean up ert-font-lock error messages

* lisp/emacs-lisp/ert-font-lock.el: Remove redundant requires.
(ert-font-lock--parse-macro-args): First return value 'doc' being
nil already indicates omission of a docstring, so remove redundant
second return value doc-p.  All users updated.  Fix error
messages (bug#76372).
(ert-font-lock--check-faces): Simplify with ensure-list.
---
 lisp/emacs-lisp/ert-font-lock.el | 38 ++++++++++++--------------------
 1 file changed, 14 insertions(+), 24 deletions(-)

diff --git a/lisp/emacs-lisp/ert-font-lock.el b/lisp/emacs-lisp/ert-font-lock.el
index 80f4a6d5467..0f8e90d747c 100644
--- a/lisp/emacs-lisp/ert-font-lock.el
+++ b/lisp/emacs-lisp/ert-font-lock.el
@@ -37,8 +37,6 @@
 
 (require 'ert)
 (require 'ert-x)
-(require 'newcomment)
-(require 'pcase)
 
 (defconst ert-font-lock--face-symbol-re
   (rx (+ (or alphanumeric "-" "_" "." "/")))
@@ -100,25 +98,24 @@ ert-font-lock--test-body-file
 
 (defun ert-font-lock--parse-macro-args (doc-keys-mode-arg)
   "Parse DOC-KEYS-MODE-ARG macro argument list."
-  (let (doc doc-p mode arg)
+  (let (doc mode arg)
 
     (when (stringp (car doc-keys-mode-arg))
-      (setq doc (pop doc-keys-mode-arg)
-            doc-p t))
+      (setq doc (pop doc-keys-mode-arg)))
 
     (pcase-let
         ((`(,keys ,mode-arg)
           (ert--parse-keys-and-body doc-keys-mode-arg)))
 
       (unless (symbolp (car mode-arg))
-        (error "A major mode symbol expected: %S" (car mode-arg)))
+        (error "Expected a major mode symbol: %S" (car mode-arg)))
       (setq mode (pop mode-arg))
 
       (unless (stringp (car mode-arg))
-        (error "A string or file with assertions expected: %S" (car mode-arg)))
+        (error "Expected a string or file with assertions: %S" (car mode-arg)))
       (setq arg (pop mode-arg))
 
-      (list doc doc-p keys mode arg))))
+      (list doc keys mode arg))))
 
 ;;;###autoload
 (defmacro ert-font-lock-deftest (name &rest docstring-keys-mode-and-str)
@@ -139,22 +136,20 @@ ert-font-lock-deftest
                            stringp))
            (doc-string 2)
            (indent 1))
-  (pcase-let ((`(,documentation
-                 ,documentation-supplied-p
-                 ,keys ,mode ,arg)
+  (pcase-let ((`(,documentation ,keys ,mode ,arg)
                (ert-font-lock--parse-macro-args docstring-keys-mode-and-str)))
 
     `(ert-set-test ',name
                    (make-ert-test
                     :name ',name
-                    ,@(when documentation-supplied-p
+                    ,@(when documentation
                         `(:documentation ,documentation))
                     ,@(when (map-contains-key keys :expected-result)
                         `(:expected-result-type ,(map-elt keys :expected-result)))
                     ,@(when (map-contains-key keys :tags)
                         `(:tags ,(map-elt keys :tags)))
-                    :body (lambda () (ert-font-lock--test-body-str ',mode ,arg ',name))
-
+                    :body (lambda ()
+                            (ert-font-lock--test-body-str ',mode ,arg ',name))
                     :file-name ,(or (macroexp-file-name) buffer-file-name)))))
 
 ;;;###autoload
@@ -178,23 +173,20 @@ ert-font-lock-deftest-file
                            stringp))
            (doc-string 2)
            (indent 1))
-
-  (pcase-let ((`(,documentation
-                 ,documentation-supplied-p
-                 ,keys ,mode ,arg)
+  (pcase-let ((`(,documentation ,keys ,mode ,arg)
                (ert-font-lock--parse-macro-args docstring-keys-mode-and-file)))
 
     `(ert-set-test ',name
                    (make-ert-test
                     :name ',name
-                    ,@(when documentation-supplied-p
+                    ,@(when documentation
                         `(:documentation ,documentation))
                     ,@(when (map-contains-key keys :expected-result)
                         `(:expected-result-type ,(map-elt keys :expected-result)))
                     ,@(when (map-contains-key keys :tags)
                         `(:tags ,(map-elt keys :tags)))
                     :body (lambda () (ert-font-lock--test-body-file
-                                 ',mode (ert-resource-file ,arg) ',name))
+                                      ',mode (ert-resource-file ,arg) ',name))
                     :file-name ,(or (macroexp-file-name) buffer-file-name)))))
 
 (defun ert-font-lock--in-comment-p ()
@@ -357,10 +349,8 @@ ert-font-lock--check-faces
 
       ;; normalize both expected and resulting face - these can be
       ;; either symbols, nils or lists of symbols
-      (when (not (listp actual-face))
-        (setq actual-face (list actual-face)))
-      (when (not (listp expected-face))
-        (setq expected-face (list expected-face)))
+      (setq actual-face (ensure-list actual-face))
+      (setq expected-face (ensure-list expected-face))
 
       ;; fail when lists are not 'equal and the assertion is *not negated*
       (when (and (not negation) (not (equal actual-face expected-face)))
-- 
2.47.2


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76372; Package emacs. Full text available.

Message received at 76372 <at> debbugs.gnu.org:


Received: (at 76372) by debbugs.gnu.org; 20 Feb 2025 08:24:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 20 03:24:06 2025
Received: from localhost ([127.0.0.1]:59518 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tl1qn-0004vO-GF
	for submit <at> debbugs.gnu.org; Thu, 20 Feb 2025 03:24:05 -0500
Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]:55792)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <vekazanov@HIDDEN>)
 id 1tl1qi-0004u7-T1
 for 76372 <at> debbugs.gnu.org; Thu, 20 Feb 2025 03:24:03 -0500
Received: by mail-lf1-x132.google.com with SMTP id
 2adb3069b0e04-5452e6f2999so693061e87.3
 for <76372 <at> debbugs.gnu.org>; Thu, 20 Feb 2025 00:24:00 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740039833; x=1740644633; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=Y2TBsFgwDtG3E9rqRbgg4w/QjyJgs5cwyOtwhyDKS+I=;
 b=SaTbYHHty3OO57Vso7E4bbcdjRTP5FItXhLCV7Avs6X4G7edftQ53619JK0U3cMIQk
 SIXOx4z1oTqkap1Biif3I2oftwtzkXCoOGvJ/TAsrZg11+SyeoKPAEdzPlCDpomQcixx
 4MosirCETIwCmVvnEkUjgsRc40zaYy3dhQAieR9v231B8Y+wc/wdlivEQQTQwB5QPw10
 gMuQ2wx28hCXtGhxPgJhi0TDl1OIcAyBH2TB+YizQ9BOq5EeuQ8PICPxNxfLyR8tqdto
 +aFyiBV/X3lW0SRvYHsMpB2NuvMdxCVigWs339tF6tVHya7LE4EGqoAWYN62112zdUlK
 Wccg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740039833; x=1740644633;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=Y2TBsFgwDtG3E9rqRbgg4w/QjyJgs5cwyOtwhyDKS+I=;
 b=OH7AEyOX8Ui4zznRAb4R/2K2WPlGZBjwgwrSrs6nqlaD9nJ2sdF1ltCoD6lhYcDgCX
 /u/m3a87VJUChRZz1Mvf55fAB283u3Cy1G3EskRGXdDuUPy7hEdMe1EiyBmxKn2lCzlH
 aBwCKKq2ldOtLKOBGx+jsy5nczVVfIb/9SVp9r0ouvVzsZ/qovaHwFOBQvxom+z6xrQ8
 hAGNlerd4TExkBxJlP99ihb5woaltS/zSvpUroNFUhpDappWyPm7KISUmzMExMmlhTus
 h2EI+8Cf0ghhNmKt3O4hq4QnruRmOmvTGyd/VN3ti3drd84Mes/OUQ5pXFFKt+olAUxR
 5CPg==
X-Gm-Message-State: AOJu0YzgHQHUJEQ7qr2BOl/sjI/5X9IEYjlRYyf8pyMWNqIWRWhR5M9l
 TnMUnFtq9+Psg5o721mZ1z/nTAjwc+wcSvhEV5hhT5/8UAwFg+VGNTekPM4kUXtDStsxrO/ayxz
 zcOYlIQ3hjpzVYzf9fe0uOPd8sg==
X-Gm-Gg: ASbGncvy3NCZrezLfDeu/1+o4yv4QMFKAzmR9Z6/DG2DW1K7poc2TxULenXwvnoO6nu
 JVixamweUAcDjnWuWhCdF23l24c2fTnvb0vAfaufEFYypjrb45s4SvQxjRZGOs1Zi40js
X-Google-Smtp-Source: AGHT+IEZfdBnun5yZMhh6wE0sLJ891y48jh5sFwmGDXEtLdvjvIJwMrCzxYMZGVkAjf/hmZqdR9gI5AqNAiF44PhJr0=
X-Received: by 2002:ac2:4e05:0:b0:545:2f97:f6e9 with SMTP id
 2adb3069b0e04-5452fe71bfemr6127592e87.42.1740039832880; Thu, 20 Feb 2025
 00:23:52 -0800 (PST)
MIME-Version: 1.0
References: <87pljgcnpp.fsf@HIDDEN>
 <CAAs=0-1iJpQg3OW4dDaYGh0G-rfBGSfF5_ROtX_Z4tUs6S3JUw@HIDDEN>
 <87eczt6689.fsf@HIDDEN>
In-Reply-To: <87eczt6689.fsf@HIDDEN>
From: Vladimir Kazanov <vekazanov@HIDDEN>
Date: Thu, 20 Feb 2025 08:23:41 +0000
X-Gm-Features: AWEUYZnvl_Dyx4F9q8K09KnJKnT6xcbTsE88SoPAxgUJ3of_t8-5lGg4R2gSOoU
Message-ID: <CAAs=0-0WhQLfkpijsc0BkNKK0ZU4auT6+=CeZK4uFJs1Y4XoWg@HIDDEN>
Subject: Re: bug#76372: 31.0.50; False () in ert-font-lock macro signatures
To: "Basil L. Contovounesios" <basil@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 76372
Cc: 76372 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Feel free to push,

Thanks for looking into this!

On Wed, 19 Feb 2025 at 20:15, Basil L. Contovounesios
<basil@HIDDEN> wrote:
>
> Vladimir Kazanov [2025-02-18 19:41 +0000] wrote:
>
> > Thanks for taking a look at ert-font-lock! I am on vacation right now
> > so only have time for a brief review of the patch.
>
> No worries.
> I hope you have a nice vacation, and thanks for taking a look anyway.
>
> > -     (insert ,str)
> >       (,mode)
> > +     (insert ,str)
> >
> > Not saying this is wrong but looks like something that might change
> > things subtly. Do tests pass?
>
> Yes, tests still pass (modulo those that were already failing):
>
> $ make check
> $ make TEST_LOAD_EL=no \
>        test/{autoconf,{go,lua,rust}-ts-mode,ert{,-x,-font-lock}}-tests
>
> If this were a general-purpose macro required to be robust, I would have
> used e.g. macroexp-let2 to ensure the correct argument evaluation order.
>
> Since this is a convenience used only in tests, I thought I could get
> away with being lazy, but you caught me ;).
>
> >> -  (skip-unless (featurep 'php-mode))
> >> +  (skip-unless (fboundp 'php-mode))
> >
> > What difference does it make? featurep vs fboundp?
>
> featurep returns non-nil if the file php-mode.el has already been
> loaded, whereas fboundp returns non-nil if the function php-mode is
> defined (even as an autoload).
>
> During 'make check' it doesn't make a difference, since php-mode is not
> even installed, let alone defined as a function or feature.
>
> But if someone has php-mode.el installed via package-install, then the
> function php-mode is automatically autoloaded.  If the test tries to
> call the function php-mode, Emacs will know which file to load in order
> to find the function's real definition.  So it is not necessary to have
> php-mode.el already loaded (which involves an extra step by the user);
> it suffices to have the php-mode package installed properly in order to
> run the test.
>
> Regardless of these details, fboundp is a more accurate test-skip
> condition because all the test is doing is calling a function called
> php-mode; it does not care about where that function is defined, and
> specifically whether it's defined by a feature called php-mode.
>
> >> -    "Test reading correct assertions from a file"
> >> +  "Test reading correct assertions from a file"
> >
> > Similar to other docstrings, this asks for a period in the end.
>
> Well spotted, thanks.
>
> I've updated the patch locally, and am ready to apply further feedback,
> or push it if there are no further comments.
>
> --
> Basil



-- 
Regards,

Vladimir Kazanov




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76372; Package emacs. Full text available.

Message received at 76372 <at> debbugs.gnu.org:


Received: (at 76372) by debbugs.gnu.org; 19 Feb 2025 20:16:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 19 15:16:10 2025
Received: from localhost ([127.0.0.1]:52544 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tkqUL-0003jJ-9H
	for submit <at> debbugs.gnu.org; Wed, 19 Feb 2025 15:16:10 -0500
Received: from mta-09-4.privateemail.com ([198.54.127.118]:53377)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <basil@HIDDEN>)
 id 1tkqUF-0003hh-Gt
 for 76372 <at> debbugs.gnu.org; Wed, 19 Feb 2025 15:16:07 -0500
Received: from mta-09.privateemail.com (localhost [127.0.0.1])
 by mta-09.privateemail.com (Postfix) with ESMTP id 4YynhX61Rnz3hhV2;
 Wed, 19 Feb 2025 15:15:56 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=contovou.net;
 s=default; t=1739996156;
 bh=VCs15byUw//59FOiKhmVOWqihzLyJZ8WGKiVqvDDxRs=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=LsaujzMlFhQmxtpiy2UxA0Sl9NM2e8AOf3tf9bmjLT/sdp2Ku+OPhAwmcdmlh+CTb
 KNUedm/uPwfzcF9lJC/r2pPlack7iAN6mfd6iLPiTZY4tq7lloDua6k2t+t0r58o6z
 /WIeRJfCBEJ13C1EmoF6S1woIJn1lZkhHdfubG4Hnss56nddWCH1Y53HStAiVir4+2
 3LHLgc2BLF4qWUiuksuVuJSp/n9ur0yQsRjzEfJf7Yvm7xCICCnUTZc+7iDPnxeOie
 5rJXmmg4WhgrrrftDTtz9eyKeUHXmBVBfiR9r6hQ4a+3i9/z/AczaNoaBkvI2/eZA0
 JiWl+/9gAPzFA==
Received: from localhost (unknown [31.46.242.24])
 by mta-09.privateemail.com (Postfix) with ESMTPA;
 Wed, 19 Feb 2025 15:15:55 -0500 (EST)
From: "Basil L. Contovounesios" <basil@HIDDEN>
To: Vladimir Kazanov <vekazanov@HIDDEN>
Subject: Re: bug#76372: 31.0.50; False () in ert-font-lock macro signatures
In-Reply-To: <CAAs=0-1iJpQg3OW4dDaYGh0G-rfBGSfF5_ROtX_Z4tUs6S3JUw@HIDDEN>
References: <87pljgcnpp.fsf@HIDDEN>
 <CAAs=0-1iJpQg3OW4dDaYGh0G-rfBGSfF5_ROtX_Z4tUs6S3JUw@HIDDEN>
Date: Wed, 19 Feb 2025 21:15:50 +0100
Message-ID: <87eczt6689.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Virus-Scanned: ClamAV using ClamSMTP
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 76372
Cc: 76372 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Vladimir Kazanov [2025-02-18 19:41 +0000] wrote:

> Thanks for taking a look at ert-font-lock! I am on vacation right now
> so only have time for a brief review of the patch.

No worries.
I hope you have a nice vacation, and thanks for taking a look anyway.

> -     (insert ,str)
>       (,mode)
> +     (insert ,str)
>
> Not saying this is wrong but looks like something that might change
> things subtly. Do tests pass?

Yes, tests still pass (modulo those that were already failing):

$ make check
$ make TEST_LOAD_EL=no \
       test/{autoconf,{go,lua,rust}-ts-mode,ert{,-x,-font-lock}}-tests

If this were a general-purpose macro required to be robust, I would have
used e.g. macroexp-let2 to ensure the correct argument evaluation order.

Since this is a convenience used only in tests, I thought I could get
away with being lazy, but you caught me ;).

>> -  (skip-unless (featurep 'php-mode))
>> +  (skip-unless (fboundp 'php-mode))
>
> What difference does it make? featurep vs fboundp?

featurep returns non-nil if the file php-mode.el has already been
loaded, whereas fboundp returns non-nil if the function php-mode is
defined (even as an autoload).

During 'make check' it doesn't make a difference, since php-mode is not
even installed, let alone defined as a function or feature.

But if someone has php-mode.el installed via package-install, then the
function php-mode is automatically autoloaded.  If the test tries to
call the function php-mode, Emacs will know which file to load in order
to find the function's real definition.  So it is not necessary to have
php-mode.el already loaded (which involves an extra step by the user);
it suffices to have the php-mode package installed properly in order to
run the test.

Regardless of these details, fboundp is a more accurate test-skip
condition because all the test is doing is calling a function called
php-mode; it does not care about where that function is defined, and
specifically whether it's defined by a feature called php-mode.

>> -    "Test reading correct assertions from a file"
>> +  "Test reading correct assertions from a file"
>
> Similar to other docstrings, this asks for a period in the end.

Well spotted, thanks.

I've updated the patch locally, and am ready to apply further feedback,
or push it if there are no further comments.

-- 
Basil




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76372; Package emacs. Full text available.

Message received at 76372 <at> debbugs.gnu.org:


Received: (at 76372) by debbugs.gnu.org; 18 Feb 2025 19:41:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 18 14:41:31 2025
Received: from localhost ([127.0.0.1]:33635 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tkTTF-0008Bl-R3
	for submit <at> debbugs.gnu.org; Tue, 18 Feb 2025 14:41:30 -0500
Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]:46085)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <vekazanov@HIDDEN>)
 id 1tkTTC-0008Ao-VR
 for 76372 <at> debbugs.gnu.org; Tue, 18 Feb 2025 14:41:27 -0500
Received: by mail-lj1-x233.google.com with SMTP id
 38308e7fff4ca-30a303a656aso24286021fa.0
 for <76372 <at> debbugs.gnu.org>; Tue, 18 Feb 2025 11:41:26 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1739907680; x=1740512480; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=M4vUUyenHdbIuqvOYfuy5kCtSBsq21F1nXe6ZMNiMqE=;
 b=CNAzxh6jb6NRDE05X+ejlalMazSSrcnW9JBJH7SSGuFZuAXcXF0RMc62kwqrXBDD1I
 CmZKxrIMUd+wgKj9qd0iyzEWy46btxvBtdzWXyMuLWpLFlzEv8jJ5DXrXkpT81zsxw2A
 hDG1frbxYmRqyo0Ftg/NIk27pwIhzPY2aN7edIUztkLaZW2dVVKlIIszB5sOEJ6ixGal
 wzBFOgOEpoJV4HXbwIiXJi4nRlTwJ5q1efbK/NvrTIYFQtVPp9rLs29TekFoJUQdB+es
 qvR0QFXrd3JKstcuqRHArb50GbfcQdqCqyymONybHsV5+jAP/T5GR80YMI/QJNVIHlbG
 1XyQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1739907680; x=1740512480;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=M4vUUyenHdbIuqvOYfuy5kCtSBsq21F1nXe6ZMNiMqE=;
 b=E1cn5ihlUwxJx6yk+CgXSngb4gxpzgyk5FRBR3gXC7h1N2cJm03tKeKFGNXq2VfcC3
 bv6xwpzdyzFSOcRZkQ4J0wzJXk7DqZk1xr6G87feIx2CdCmzm2GOlxO3d/vS6KGd3yWn
 WCv898NloBI4Hm2ldDWs/d6hLsV98gAcDvf+CY3C09dVpCRPTqsmLLVjK6k6MqlDmnom
 N0pltl/FJ9XiesoE0RxfpRk2FZnmQltDANKmPoPyHzdseSVHveqVNkger7Q4R06+YStQ
 MjW9bzD0BJu4udXDoCFLeSZoN2ipCvVJ1fANsgc3w+UPFUSld6D4yj/5yBV7adzBzlHH
 yZDw==
X-Gm-Message-State: AOJu0YyfxzPcYghWaZxE81AZHrvCQNHJOpJ3UlZ4FgHpMXmn9G0nluJv
 g2L6rbHSg7cqgR60Uq7Kp0JrribNgEf54zhnjjzCvQY8eebZlFUW6qjjmYy7bOQLvy70LzKVqZu
 qjjZyJbZ67hcIK2oNAFFnPXWl4NnJIr4rnQ==
X-Gm-Gg: ASbGncsPVFI9/LCwkUA2W68jPoKcInCBRBxfb+Qa1s65hs4wjkwfFmI+LU31o2kyqD4
 +gP2mC9bXWMjdzg9wVSvamzerJ+bm6L5GwtF4RGfZiVCW3TEMC50FeubIQRbO1CFNbi/NaA==
X-Google-Smtp-Source: AGHT+IFiDdtIY5HVxSB4wmncjBGRphmScbiOSFsWmrcYq519VhD4YXTZZHe9zCApPLmxtSo0PiLg9c3AQANpX60vBWM=
X-Received: by 2002:a2e:7c0f:0:b0:302:1861:6de7 with SMTP id
 38308e7fff4ca-30927ad551emr42235151fa.24.1739907680054; Tue, 18 Feb 2025
 11:41:20 -0800 (PST)
MIME-Version: 1.0
References: <87pljgcnpp.fsf@HIDDEN>
In-Reply-To: <87pljgcnpp.fsf@HIDDEN>
From: Vladimir Kazanov <vekazanov@HIDDEN>
Date: Tue, 18 Feb 2025 19:41:08 +0000
X-Gm-Features: AWEUYZmMIP1GfjYEgFK1HXHyPQ9Ad2JEg2pHfdlxBdUBSAq7NkGDlVv_zwHezsA
Message-ID: <CAAs=0-1iJpQg3OW4dDaYGh0G-rfBGSfF5_ROtX_Z4tUs6S3JUw@HIDDEN>
Subject: Re: bug#76372: 31.0.50; False () in ert-font-lock macro signatures
To: "Basil L. Contovounesios" <basil@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 76372
Cc: 76372 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Basil,

Thanks for taking a look at ert-font-lock! I am on vacation right now
so only have time for a brief review of the patch.

So here are a couple of comments/questions for the patch:

-      (when (not (listp actual-face))
-        (setq actual-face (list actual-face)))
-      (when (not (listp expected-face))
-        (setq expected-face (list expected-face)))
+      (setq actual-face (ensure-list actual-face))
+      (setq expected-face (ensure-list expected-face))

This is cool!

-     (insert ,str)
      (,mode)
+     (insert ,str)

Not saying this is wrong but looks like something that might change
things subtly. Do tests pass?

> -  (skip-unless (featurep 'php-mode))
> +  (skip-unless (fboundp 'php-mode))

What difference does it make? featurep vs fboundp?

> -    "Test reading correct assertions from a file"
> +  "Test reading correct assertions from a file"

Similar to other docstrings, this asks for a period in the end.

Otherwise, great to see my rusty Elisp and non-native English cleaned up a bit.

Thanks
Vlad

On Mon, 17 Feb 2025 at 20:38, Basil L. Contovounesios
<basil@HIDDEN> wrote:
>
> 0. emacs -Q
> 1. C-h f ert-font-lock-deftest RET
>
> *Help* now reports the macro's calling convention as:
>
>   (ert-font-lock-deftest NAME () [DOCSTRING] ...)
>
> but the second () argument is not actually supported by the macro, whose
> arglist reads:
>
>   (name &rest docstring-keys-mode-and-str)
>
> Here, ert-font-lock--parse-macro-args expects
> docstring-keys-mode-and-str to start with an (optional) string,
> not the empty arglist '().
>
> The symptom of this mismatch is that calls to ert-font-lock-deftest are
> misindented (malindented? :) and misfontified.  For example, in
> ert-font-lock-tests.el:
>
>   (ert-font-lock-deftest test-macro-test--correct-highlighting
>       emacs-lisp-mode
>     "
>   (defun fun ())
>   ;; ^ font-lock-keyword-face
>   ;;      ^ font-lock-function-name-face")
>
> Here, the string literal has font-lock-doc-face instead of
> font-lock-string-face.
>
>   (ert-font-lock-deftest test-macro-test--docstring
>       "A test with a docstring."
>     emacs-lisp-mode
>     "
>   (defun fun ())
>   ;; ^ font-lock-keyword-face"
>     )
>
> Here, both strings have font-lock-string-face, whereas the first should
> have font-lock-doc-face.
>
> Finally, if a test actually followed ert-font-lock-deftest's docstring
> in including an empty arglist (), then ert-describe-test would claim
> that it is not documented.
>
> The attached patch tries to address these issues.
> WDYT?
>
> Thanks,
> --
> Basil
>
>
> In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
>  version 1.18.2, Xaw3d scroll bars) of 2025-02-16 built on tais
> Repository revision: fc189cb83cf7284344a737e75b3ee56487b1c386
> Repository branch: master
> Windowing system distributor 'The X.Org Foundation', version 11.0.12101015
> System Description: Debian GNU/Linux trixie/sid
>
> Configured using:
>  'configure 'CFLAGS=-Og -ggdb3' -C --prefix=/home/blc/.local
>  --enable-checking=structs --without-native-compilation
>  --with-file-notification --with-x-toolkit=lucid --with-x'
>
> Configured features:
> ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
> LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
> INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
> TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XAW3D XDBE XIM XINERAMA XINPUT2
> XPM XRANDR LUCID ZLIB
>
> Important settings:
>   value of $LANG: en_IE.UTF-8
>   locale-coding-system: utf-8-unix
>
> Major mode: Lisp Interaction
>
> Minor modes in effect:
>   tooltip-mode: t
>   global-eldoc-mode: t
>   eldoc-mode: t
>   show-paren-mode: t
>   electric-indent-mode: t
>   mouse-wheel-mode: t
>   tool-bar-mode: t
>   menu-bar-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   blink-cursor-mode: t
>   minibuffer-regexp-mode: t
>   line-number-mode: t
>   indent-tabs-mode: t
>   transient-mark-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>
> Load-path shadows:
> None found.
>
> Features:
> (shadow sort mail-extr emacsbug message mailcap yank-media puny dired
> dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
> epg-config gnus-util time-date mm-decode mm-bodies mm-encode mail-parse
> rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
> ietf-drums mm-util mail-prsvr mail-utils cl-extra shortdoc
> text-property-search comp-common rx ert-font-lock pcase ert-x subr-x ert
> map pp ewoc debug backtrace find-func thingatpt help-fns byte-opt gv
> bytecomp byte-compile radix-tree help-mode cl-loaddefs cl-lib rmc
> iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
> vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
> term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt
> fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
> register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
> scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
> frame minibuffer nadvice seq simple cl-generic indonesian philippine
> cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
> korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
> european ethiopic indian cyrillic chinese composite emoji-zwj charscript
> charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
> cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
> files window text-properties overlay sha1 md5 base64 format env
> code-pages mule custom widget keymap hashtable-print-readable backquote
> threads dbusbind inotify lcms2 dynamic-setting system-font-setting
> font-render-setting cairo x-toolkit xinput2 x multi-tty move-toolbar
> make-network-process tty-child-frames emacs)
>
> Memory information:
> ((conses 16 75191 9165) (symbols 48 7566 0) (strings 32 22214 1377)
>  (string-bytes 1 522717) (vectors 16 13949)
>  (vector-slots 8 148704 7756) (floats 8 87 2) (intervals 56 318 7)
>  (buffers 992 11))



-- 
Regards,

Vladimir Kazanov




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76372; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 17 Feb 2025 20:37:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 17 15:37:40 2025
Received: from localhost ([127.0.0.1]:49877 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tk7s2-0006R0-Rj
	for submit <at> debbugs.gnu.org; Mon, 17 Feb 2025 15:37:40 -0500
Received: from lists.gnu.org ([2001:470:142::17]:50646)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <basil@HIDDEN>)
 id 1tk7rz-0006QG-CS
 for submit <at> debbugs.gnu.org; Mon, 17 Feb 2025 15:37:37 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <basil@HIDDEN>)
 id 1tk7rs-00053Z-Rn
 for bug-gnu-emacs@HIDDEN; Mon, 17 Feb 2025 15:37:28 -0500
Received: from mta-06-4.privateemail.com ([198.54.122.146])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <basil@HIDDEN>)
 id 1tk7rp-00015V-Id
 for bug-gnu-emacs@HIDDEN; Mon, 17 Feb 2025 15:37:28 -0500
Received: from mta-06.privateemail.com (localhost [127.0.0.1])
 by mta-06.privateemail.com (Postfix) with ESMTP id 4YxZGB5PVtz3hhVN
 for <bug-gnu-emacs@HIDDEN>; Mon, 17 Feb 2025 15:37:22 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=contovou.net;
 s=default; t=1739824642;
 bh=rOMy68c4VPKHRQiCpL9jprLWO9hOvGpN3+A+RLsPIHk=;
 h=From:To:Subject:Date:From;
 b=Q7EKjvfRYk2c1wEVHx0oPFntwczLC087yeqiBzA1vbjyHEAgb8erFM5T1PkPKCQ+a
 /3j+8mxefOtfrvqqqhfKRVA5mKUyAI78gznRSFITvNXMTNRaccmr6gLtsDj73FsPiL
 pKPmiZsOqM7s5Go8GzlM8DPA/q7RUXuA/z6DmOQ4rPg/RsazyxxwIQnDYH/sf6GzhK
 bQ2gVWw+VN2diVbaAZOzfD2XXrByvV1+8hE4w5YIyLY3Y+mWkSTjx7YiLY4dQh0SS1
 Wayw2kayHy43rCSNfjnr7chDXCPkrhv0rnEENsiU1tnU96+edAPSIEtvmGtWzumYNa
 LRRB3ait6D11A==
Received: from localhost (unknown [146.70.196.201])
 by mta-06.privateemail.com (Postfix) with ESMTPA
 for <bug-gnu-emacs@HIDDEN>; Mon, 17 Feb 2025 15:37:21 -0500 (EST)
From: "Basil L. Contovounesios" <basil@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 31.0.50; False () in ert-font-lock macro signatures
X-Debbugs-Cc: Vladimir Kazanov <vekazanov@HIDDEN>
Date: Mon, 17 Feb 2025 21:37:06 +0100
Message-ID: <87pljgcnpp.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Virus-Scanned: ClamAV using ClamSMTP
Received-SPF: pass client-ip=198.54.122.146; envelope-from=basil@HIDDEN;
 helo=MTA-06-4.privateemail.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,
 RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--=-=-=
Content-Type: text/plain

0. emacs -Q
1. C-h f ert-font-lock-deftest RET

*Help* now reports the macro's calling convention as:

  (ert-font-lock-deftest NAME () [DOCSTRING] ...)

but the second () argument is not actually supported by the macro, whose
arglist reads:

  (name &rest docstring-keys-mode-and-str)

Here, ert-font-lock--parse-macro-args expects
docstring-keys-mode-and-str to start with an (optional) string,
not the empty arglist '().

The symptom of this mismatch is that calls to ert-font-lock-deftest are
misindented (malindented? :) and misfontified.  For example, in
ert-font-lock-tests.el:

  (ert-font-lock-deftest test-macro-test--correct-highlighting
      emacs-lisp-mode
    "
  (defun fun ())
  ;; ^ font-lock-keyword-face
  ;;      ^ font-lock-function-name-face")

Here, the string literal has font-lock-doc-face instead of
font-lock-string-face.

  (ert-font-lock-deftest test-macro-test--docstring
      "A test with a docstring."
    emacs-lisp-mode
    "
  (defun fun ())
  ;; ^ font-lock-keyword-face"
    )

Here, both strings have font-lock-string-face, whereas the first should
have font-lock-doc-face.

Finally, if a test actually followed ert-font-lock-deftest's docstring
in including an empty arglist (), then ert-describe-test would claim
that it is not documented.

The attached patch tries to address these issues.
WDYT?

Thanks,
-- 
Basil


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Fix-ert-font-lock-macro-signatures.patch

From 6487a8876fcd66ee38bd67b02994a2ad2b635886 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <basil@HIDDEN>
Date: Sun, 16 Feb 2025 16:29:13 +0100
Subject: [PATCH] Fix ert-font-lock macro signatures

* doc/misc/ert.texi (Syntax Highlighting Tests):
* test/lisp/emacs-lisp/ert-font-lock-tests.el
(test-line-comment-p--emacs-lisp, test-line-comment-p--shell-script)
(test-line-comment-p--javascript, test-line-comment-p--python)
(test-line-comment-p--c, test-macro-test--correct-highlighting)
(test-macro-test--docstring, test-macro-test--failing)
(test-macro-test--file, test-macro-test--file-no-asserts)
(test-macro-test--file-failing): Reindent macro calls.
(with-temp-buffer-str-mode): Evaluate macro arguments left-to-right.
(ert-font-lock--wrap-begin-end): Use rx for more robust composition.
(test-line-comment-p--php): Require that php-mode is callable, not
already loaded.

* lisp/emacs-lisp/ert-font-lock.el: Remove redundant requires.
(ert-font-lock--parse-macro-args): First return value 'doc' being
nil already indicates omission of a docstring, so remove redundant
second return value doc-p.  All users updated.  Fix error messages.
(ert-font-lock-deftest, ert-font-lock-deftest-file): NAME is not
followed by an empty list like in ert-deftest, so the optional
DOCSTRING is actually the second argument.  Adapt calling convention
in docstring, and debug, doc-string, and indent properties
accordingly.  Fix docstring grammar, document MAJOR-MODE, and avoid
referring to a file name as a path.
(ert-font-lock--check-faces): Simplify with ensure-list.
---
 doc/misc/ert.texi                           | 10 +--
 lisp/emacs-lisp/ert-font-lock.el            | 77 ++++++++---------
 test/lisp/emacs-lisp/ert-font-lock-tests.el | 94 ++++++++++-----------
 3 files changed, 87 insertions(+), 94 deletions(-)

diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi
index 566fa03bf3f..8f9e4fff415 100644
--- a/doc/misc/ert.texi
+++ b/doc/misc/ert.texi
@@ -962,7 +962,7 @@ Syntax Highlighting Tests
 comments directly and can be read either from inline strings or files.
 The parser expects the input string to contain at least one assertion.
 
-Test assertion parser extracts tests from comment-only lines.  Every
+The test assertion parser extracts tests from comment-only lines.  Every
 comment assertion line starts either with a caret (@samp{^}) or an arrow
 (@samp{<-}).  A single caret/arrow or carets should be followed
 immediately by the name of a face or a list of faces to be checked
@@ -984,7 +984,7 @@ Syntax Highlighting Tests
 @end example
 
 Both symbol-only @code{:face} property values and assertion face values
-are normalized to single element lists so assertions below are
+are normalized to single element lists so the assertions below are
 equivalent:
 
 @example
@@ -1061,7 +1061,7 @@ Syntax Highlighting Tests
 
 @lisp
 (ert-font-lock-deftest test-macro-test--inline
-    emacs-lisp-mode
+  emacs-lisp-mode
   "
 (defun fun ())
 ;; ^ font-lock-keyword-face
@@ -1075,13 +1075,13 @@ Syntax Highlighting Tests
 
 @lisp
 (ert-font-lock-deftest-file test-macro-test--file
-    "Test reading correct assertions from a file"
+  "Test reading correct assertions from a file."
   javascript-mode
   "correct.js")
 @end lisp
 
 The @code{ert-font-lock-deftest} and @code{ert-font-lock-deftest-file}
-macros accept the same keyword parameters as @code{ert-deftest} i.e.,
+macros accept the same keyword arguments as @code{ert-deftest}, i.e.,
 @code{:tag} and @code{:expected-result}.
 
 
diff --git a/lisp/emacs-lisp/ert-font-lock.el b/lisp/emacs-lisp/ert-font-lock.el
index e584eb679fd..0f8e90d747c 100644
--- a/lisp/emacs-lisp/ert-font-lock.el
+++ b/lisp/emacs-lisp/ert-font-lock.el
@@ -27,8 +27,8 @@
 ;; highlighting provided by font-lock.
 ;;
 ;; ert-font-lock entry points are functions
-;; `ert-font-lock-test-string' and `ert-font-lock-test-file' and
-;; convenience macros: `ert-font-lock-deftest' and
+;; `ert-font-lock-test-string' and `ert-font-lock-test-file', and
+;; convenience macros `ert-font-lock-deftest' and
 ;; `ert-font-lock-deftest-file'.
 ;;
 ;; See unit tests in ert-font-lock-tests.el for usage examples.
@@ -37,8 +37,6 @@
 
 (require 'ert)
 (require 'ert-x)
-(require 'newcomment)
-(require 'pcase)
 
 (defconst ert-font-lock--face-symbol-re
   (rx (+ (or alphanumeric "-" "_" "." "/")))
@@ -100,98 +98,95 @@ ert-font-lock--test-body-file
 
 (defun ert-font-lock--parse-macro-args (doc-keys-mode-arg)
   "Parse DOC-KEYS-MODE-ARG macro argument list."
-  (let (doc doc-p mode arg)
+  (let (doc mode arg)
 
     (when (stringp (car doc-keys-mode-arg))
-      (setq doc (pop doc-keys-mode-arg)
-            doc-p t))
+      (setq doc (pop doc-keys-mode-arg)))
 
     (pcase-let
         ((`(,keys ,mode-arg)
           (ert--parse-keys-and-body doc-keys-mode-arg)))
 
       (unless (symbolp (car mode-arg))
-        (error "A major mode symbol expected: %S" (car mode-arg)))
+        (error "Expected a major mode symbol: %S" (car mode-arg)))
       (setq mode (pop mode-arg))
 
       (unless (stringp (car mode-arg))
-        (error "A string or file with assertions expected: %S" (car mode-arg)))
+        (error "Expected a string or file with assertions: %S" (car mode-arg)))
       (setq arg (pop mode-arg))
 
-      (list doc doc-p keys mode arg))))
+      (list doc keys mode arg))))
 
 ;;;###autoload
 (defmacro ert-font-lock-deftest (name &rest docstring-keys-mode-and-str)
   "Define test NAME (a symbol) using assertions from TEST-STR.
 
-Other than MAJOR-MODE and TEST-STR parameters, this macro accepts
-the same parameters and keywords as `ert-deftest' and is intended
-to be used through `ert'.
+The MAJOR-MODE symbol determines the syntax and font lock of TEST-STR.
 
-\(fn NAME () [DOCSTRING] [:expected-result RESULT-TYPE] \
+Except for the MAJOR-MODE and TEST-STR parameters, this macro accepts
+the same arguments and keywords as `ert-deftest' and is intended to be
+used through `ert'.
+
+\(fn NAME [DOCSTRING] [:expected-result RESULT-TYPE] \
 [:tags \\='(TAG...)] MAJOR-MODE TEST-STR)"
   (declare (debug (&define [&name "test@" symbolp]
-                           sexp [&optional stringp]
+                           [&optional stringp]
                            [&rest keywordp sexp]
                            symbolp
                            stringp))
-           (doc-string 3)
-           (indent 2))
-  (pcase-let ((`(,documentation
-                 ,documentation-supplied-p
-                 ,keys ,mode ,arg)
+           (doc-string 2)
+           (indent 1))
+  (pcase-let ((`(,documentation ,keys ,mode ,arg)
                (ert-font-lock--parse-macro-args docstring-keys-mode-and-str)))
 
     `(ert-set-test ',name
                    (make-ert-test
                     :name ',name
-                    ,@(when documentation-supplied-p
+                    ,@(when documentation
                         `(:documentation ,documentation))
                     ,@(when (map-contains-key keys :expected-result)
                         `(:expected-result-type ,(map-elt keys :expected-result)))
                     ,@(when (map-contains-key keys :tags)
                         `(:tags ,(map-elt keys :tags)))
-                    :body (lambda () (ert-font-lock--test-body-str ',mode ,arg ',name))
-
+                    :body (lambda ()
+                            (ert-font-lock--test-body-str ',mode ,arg ',name))
                     :file-name ,(or (macroexp-file-name) buffer-file-name)))))
 
 ;;;###autoload
 (defmacro ert-font-lock-deftest-file (name &rest docstring-keys-mode-and-file)
   "Define test NAME (a symbol) using assertions from FILE.
 
-FILE - path to a file with assertions in ERT resource director as
-return by `ert-resource-directory'.
+FILE names a file with assertions in the ERT resource directory, as
+returned by `ert-resource-directory'.  The MAJOR-MODE symbol determines
+the syntax and font lock of FILE's contents.
 
-Other than MAJOR-MODE and FILE parameters, this macro accepts the
-same parameters and keywords as `ert-deftest' and is intended to
-be used through `ert'.
+Except for the MAJOR-MODE and FILE parameters, this macro accepts the
+same arguments and keywords as `ert-deftest' and is intended to be used
+through `ert'.
 
-\(fn NAME () [DOCSTRING] [:expected-result RESULT-TYPE] \
+\(fn NAME [DOCSTRING] [:expected-result RESULT-TYPE] \
 [:tags \\='(TAG...)] MAJOR-MODE FILE)"
   (declare (debug (&define [&name "test@" symbolp]
-                           sexp [&optional stringp]
+                           [&optional stringp]
                            [&rest keywordp sexp]
                            symbolp
                            stringp))
-           (doc-string 3)
-           (indent 2))
-
-  (pcase-let ((`(,documentation
-                 ,documentation-supplied-p
-                 ,keys ,mode ,arg)
+           (doc-string 2)
+           (indent 1))
+  (pcase-let ((`(,documentation ,keys ,mode ,arg)
                (ert-font-lock--parse-macro-args docstring-keys-mode-and-file)))
 
     `(ert-set-test ',name
                    (make-ert-test
                     :name ',name
-                    ,@(when documentation-supplied-p
+                    ,@(when documentation
                         `(:documentation ,documentation))
                     ,@(when (map-contains-key keys :expected-result)
                         `(:expected-result-type ,(map-elt keys :expected-result)))
                     ,@(when (map-contains-key keys :tags)
                         `(:tags ,(map-elt keys :tags)))
                     :body (lambda () (ert-font-lock--test-body-file
-                                 ',mode (ert-resource-file ,arg) ',name))
+                                      ',mode (ert-resource-file ,arg) ',name))
                     :file-name ,(or (macroexp-file-name) buffer-file-name)))))
 
 (defun ert-font-lock--in-comment-p ()
@@ -354,10 +349,8 @@ ert-font-lock--check-faces
 
       ;; normalize both expected and resulting face - these can be
       ;; either symbols, nils or lists of symbols
-      (when (not (listp actual-face))
-        (setq actual-face (list actual-face)))
-      (when (not (listp expected-face))
-        (setq expected-face (list expected-face)))
+      (setq actual-face (ensure-list actual-face))
+      (setq expected-face (ensure-list expected-face))
 
       ;; fail when lists are not 'equal and the assertion is *not negated*
       (when (and (not negation) (not (equal actual-face expected-face)))
diff --git a/test/lisp/emacs-lisp/ert-font-lock-tests.el b/test/lisp/emacs-lisp/ert-font-lock-tests.el
index e410cf5fa13..194a79f32b7 100644
--- a/test/lisp/emacs-lisp/ert-font-lock-tests.el
+++ b/test/lisp/emacs-lisp/ert-font-lock-tests.el
@@ -39,13 +39,13 @@ with-temp-buffer-str-mode
   "Create a buffer with STR contents and MODE. "
   (declare (indent 1) (debug t))
   `(with-temp-buffer
-     (insert ,str)
      (,mode)
+     (insert ,str)
      (goto-char (point-min))
      ,@body))
 
 (defun ert-font-lock--wrap-begin-end (re)
-  (concat "^" re "$"))
+  (rx bol (regexp re) eol))
 
 ;;; Regexp tests
 ;;;
@@ -97,89 +97,89 @@ test-line-comment-p--fundamental
 
 (ert-deftest test-line-comment-p--emacs-lisp ()
   (with-temp-buffer-str-mode emacs-lisp-mode
-                             "not comment
+    "not comment
 ;; comment
 "
-                             (should-not (ert-font-lock--line-comment-p))
-                             (forward-line)
-                             (should (ert-font-lock--line-comment-p))
-                             (forward-line)
-                             (should-not (ert-font-lock--line-comment-p))))
+    (should-not (ert-font-lock--line-comment-p))
+    (forward-line)
+    (should (ert-font-lock--line-comment-p))
+    (forward-line)
+    (should-not (ert-font-lock--line-comment-p))))
 
 (ert-deftest test-line-comment-p--shell-script ()
   (with-temp-buffer-str-mode shell-script-mode
-                             "echo Not a comment
+    "echo Not a comment
 # comment
 "
-                             (should-not (ert-font-lock--line-comment-p))
-                             (forward-line)
-                             (should (ert-font-lock--line-comment-p))))
+    (should-not (ert-font-lock--line-comment-p))
+    (forward-line)
+    (should (ert-font-lock--line-comment-p))))
 
 (declare-function php-mode "php-mode")
 (ert-deftest test-line-comment-p--php ()
-  (skip-unless (featurep 'php-mode))
+  (skip-unless (fboundp 'php-mode))
 
   (with-temp-buffer-str-mode php-mode
-                             "echo 'Not a comment'
+    "echo 'Not a comment'
 // comment
 /* comment */
 "
-                             (should-not (ert-font-lock--line-comment-p))
-                             (forward-line)
-                             (should (ert-font-lock--line-comment-p))
-                             (forward-line)
-                             (should (ert-font-lock--line-comment-p))))
+    (should-not (ert-font-lock--line-comment-p))
+    (forward-line)
+    (should (ert-font-lock--line-comment-p))
+    (forward-line)
+    (should (ert-font-lock--line-comment-p))))
 
 
 (ert-deftest test-line-comment-p--javascript ()
   (with-temp-buffer-str-mode javascript-mode
-                             "// comment
+    "// comment
 
    // comment, after a blank line
 
 var abc = function(d) {};
 "
-                             (should (ert-font-lock--line-comment-p))
+    (should (ert-font-lock--line-comment-p))
 
-                             (forward-line)
-                             (should-not (ert-font-lock--line-comment-p))
+    (forward-line)
+    (should-not (ert-font-lock--line-comment-p))
 
-                             (forward-line)
-                             (should (ert-font-lock--line-comment-p))
+    (forward-line)
+    (should (ert-font-lock--line-comment-p))
 
-                             (forward-line)
-                             (should-not (ert-font-lock--line-comment-p))
+    (forward-line)
+    (should-not (ert-font-lock--line-comment-p))
 
-                             (forward-line)
-                             (should-not (ert-font-lock--line-comment-p))))
+    (forward-line)
+    (should-not (ert-font-lock--line-comment-p))))
 
 (ert-deftest test-line-comment-p--python ()
 
   (with-temp-buffer-str-mode python-mode
-                             "# comment
+    "# comment
 
    # comment
 print(\"Hello, world!\")"
-                             (should (ert-font-lock--line-comment-p))
+    (should (ert-font-lock--line-comment-p))
 
-                             (forward-line)
-                             (should-not (ert-font-lock--line-comment-p))
+    (forward-line)
+    (should-not (ert-font-lock--line-comment-p))
 
-                             (forward-line)
-                             (should (ert-font-lock--line-comment-p))
+    (forward-line)
+    (should (ert-font-lock--line-comment-p))
 
-                             (forward-line)
-                             (should-not (ert-font-lock--line-comment-p))))
+    (forward-line)
+    (should-not (ert-font-lock--line-comment-p))))
 
 (ert-deftest test-line-comment-p--c ()
 
   (with-temp-buffer-str-mode c-mode
-                             "// comment
+    "// comment
 /* also comment */"
-                             (should (ert-font-lock--line-comment-p))
+    (should (ert-font-lock--line-comment-p))
 
-                             (forward-line)
-                             (should (ert-font-lock--line-comment-p))))
+    (forward-line)
+    (should (ert-font-lock--line-comment-p))))
 
 (ert-deftest test-parse-comments--no-assertion-error ()
   (let* ((str "
@@ -568,14 +568,14 @@ test-font-lock-test-file--wrong
 ;;
 
 (ert-font-lock-deftest test-macro-test--correct-highlighting
-    emacs-lisp-mode
+  emacs-lisp-mode
   "
 (defun fun ())
 ;; ^ font-lock-keyword-face
 ;;      ^ font-lock-function-name-face")
 
 (ert-font-lock-deftest test-macro-test--docstring
-    "A test with a docstring."
+  "A test with a docstring."
   emacs-lisp-mode
   "
 (defun fun ())
@@ -583,7 +583,7 @@ fun
   )
 
 (ert-font-lock-deftest test-macro-test--failing
-    "A failing test."
+  "A failing test."
   :expected-result :failed
   emacs-lisp-mode
   "
@@ -591,18 +591,18 @@ fun
 ;; ^ wrong-face")
 
 (ert-font-lock-deftest-file test-macro-test--file
-    "Test reading correct assertions from a file"
+  "Test reading correct assertions from a file"
   javascript-mode
   "correct.js")
 
 (ert-font-lock-deftest-file test-macro-test--file-no-asserts
-    "Check failing on files without assertions"
+  "Check failing on files without assertions."
   :expected-result :failed
   javascript-mode
   "no-asserts.js")
 
 (ert-font-lock-deftest-file test-macro-test--file-failing
-    "Test reading wrong assertions from a file"
+  "Test reading wrong assertions from a file."
   :expected-result :failed
   javascript-mode
   "broken.js")
-- 
2.47.2


--=-=-=
Content-Type: text/plain


In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.18.2, Xaw3d scroll bars) of 2025-02-16 built on tais
Repository revision: fc189cb83cf7284344a737e75b3ee56487b1c386
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101015
System Description: Debian GNU/Linux trixie/sid

Configured using:
 'configure 'CFLAGS=-Og -ggdb3' -C --prefix=/home/blc/.local
 --enable-checking=structs --without-native-compilation
 --with-file-notification --with-x-toolkit=lucid --with-x'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XAW3D XDBE XIM XINERAMA XINPUT2
XPM XRANDR LUCID ZLIB

Important settings:
  value of $LANG: en_IE.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util time-date mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils cl-extra shortdoc
text-property-search comp-common rx ert-font-lock pcase ert-x subr-x ert
map pp ewoc debug backtrace find-func thingatpt help-fns byte-opt gv
bytecomp byte-compile radix-tree help-mode cl-loaddefs cl-lib rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo x-toolkit xinput2 x multi-tty move-toolbar
make-network-process tty-child-frames emacs)

Memory information:
((conses 16 75191 9165) (symbols 48 7566 0) (strings 32 22214 1377)
 (string-bytes 1 522717) (vectors 16 13949)
 (vector-slots 8 148704 7756) (floats 8 87 2) (intervals 56 318 7)
 (buffers 992 11))

--=-=-=--




Acknowledgement sent to "Basil L. Contovounesios" <basil@HIDDEN>:
New bug report received and forwarded. Copy sent to vekazanov@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to vekazanov@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#76372; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 20 Feb 2025 10:00:03 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.