summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorBasil L. Contovounesios <basil@contovou.net>2025-02-20 10:29:54 +0100
committerBasil L. Contovounesios <basil@contovou.net>2025-02-25 11:02:55 +0100
commit02c830ba22b0564f6725cd403beba4accb836061 (patch)
treeb7e74c0a1b57b0b2c9d4eaab61766a6cde91b249 /lisp/emacs-lisp
parent0c6b8643aec24935f82c63d43219f26378e3e578 (diff)
downloademacs-02c830ba22b0564f6725cd403beba4accb836061.tar.gz
emacs-02c830ba22b0564f6725cd403beba4accb836061.tar.bz2
emacs-02c830ba22b0564f6725cd403beba4accb836061.zip
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.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/ert-font-lock.el39
1 files changed, 21 insertions, 18 deletions
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 @@ Argument TEST-NAME - name of the currently running ert test."
(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 @@ to be used through `ert'.
(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