[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat 5dbe99b23f: compat-28: Add test for macroexp-fil
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat 5dbe99b23f: compat-28: Add test for macroexp-file-name |
Date: |
Thu, 12 Jan 2023 11:57:27 -0500 (EST) |
branch: externals/compat
commit 5dbe99b23f8142c968a263f67b2bce594765ada7
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
compat-28: Add test for macroexp-file-name
---
compat-28.el | 2 +-
compat-tests.el | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/compat-28.el b/compat-28.el
index 339c06e07a..8b0cae84f2 100644
--- a/compat-28.el
+++ b/compat-28.el
@@ -738,7 +738,7 @@ where the mouse button is clicked to find a thing nearby."
;;;; Defined in macroexp.el
-(compat-defun macroexp-file-name () ;; <UNTESTED>
+(compat-defun macroexp-file-name () ;; <OK>
"Return the name of the file from which the code comes.
Returns nil when we do not know.
A non-nil result is expected to be reliable when called from a macro in order
diff --git a/compat-tests.el b/compat-tests.el
index 64bb8de66f..e852d94118 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -1970,6 +1970,15 @@
(should-equal 'foo (compat-call lookup-key (list a-map b-map) "x"))
(should-equal 'bar (compat-call lookup-key (list b-map a-map) "x"))))
+;; We need an indirection since `macroexp-file-name' is a function and not a
+;; macro. I don't understand why this wrong choice was made.
+;; `macroexp-file-name' should be a macro.
+(defmacro compat-tests--filename ()
+ (macroexp-file-name))
+
+(ert-deftest macroexp-file-name ()
+ (should-equal (file-name-nondirectory (compat-tests--filename))
"compat-tests.el"))
+
(ert-deftest macroexpand-1 ()
(should-equal '(if a b c) (macroexpand-1 '(if a b c)))
(should-equal '(if a (progn b)) (macroexpand-1 '(when a b)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/compat 5dbe99b23f: compat-28: Add test for macroexp-file-name,
ELPA Syncer <=