diff options
author | Andrea Corallo <akrl@sdf.org> | 2021-02-26 19:54:59 +0100 |
---|---|---|
committer | Andrea Corallo <akrl@sdf.org> | 2021-02-26 19:54:59 +0100 |
commit | 5c922cc3a4b0677805a678267df2b7598e92bb83 (patch) | |
tree | f7680e085436621332230c7a46df36ad4048310b /test/lisp/emacs-lisp/macroexp-tests.el | |
parent | cedc55041ea5179dcb389845d2d0e3562060cab9 (diff) | |
parent | 496fa1c03b1b3ce4aa9872751e9fac45167766c2 (diff) | |
download | emacs-5c922cc3a4b0677805a678267df2b7598e92bb83.tar.gz emacs-5c922cc3a4b0677805a678267df2b7598e92bb83.tar.bz2 emacs-5c922cc3a4b0677805a678267df2b7598e92bb83.zip |
Merge remote-tracking branch 'savannah/master' into native-comp
Diffstat (limited to 'test/lisp/emacs-lisp/macroexp-tests.el')
-rw-r--r-- | test/lisp/emacs-lisp/macroexp-tests.el | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/test/lisp/emacs-lisp/macroexp-tests.el b/test/lisp/emacs-lisp/macroexp-tests.el index 1124e3b8d91..89d3882d1da 100644 --- a/test/lisp/emacs-lisp/macroexp-tests.el +++ b/test/lisp/emacs-lisp/macroexp-tests.el @@ -1,6 +1,6 @@ ;;; macroexp-tests.el --- Tests for macroexp.el -*- lexical-binding: t; -*- -;; Copyright (C) 2021 Stefan Monnier +;; Copyright (C) 2021 Free Software Foundation, Inc. ;; Author: Stefan Monnier <monnier@iro.umontreal.ca> ;; Keywords: @@ -32,5 +32,41 @@ (should (equal (macroexp--fgrep '((x) (y)) '#2=([r] ((a x)) a b c d . #2#)) '((x))))) +(defconst macroexp--tests-filename (macroexp-file-name)) + +(defmacro macroexp--test-get-file-name () (macroexp-file-name)) + +(ert-deftest macroexp--tests-file-name () + (should (string-match + "\\`macroexp-tests.elc?\\'" + (file-name-nondirectory macroexp--tests-filename))) + (let ((rsrc-dir (expand-file-name + "macroexp-resources" + (file-name-directory macroexp--tests-filename)))) + (with-current-buffer + (find-file-noselect (expand-file-name "m1.el" rsrc-dir)) + (defvar macroexp--m1-tests-filename) + (declare-function macroexp--m1-tests-file-name "m1" ()) + ;; `macroexp-file-name' should work with `eval-buffer'. + (eval-buffer) + (should (equal "m1.el" + (file-name-nondirectory macroexp--m1-tests-filename))) + (should (equal "m1.el" + (file-name-nondirectory (macroexp--m1-tests-file-name)))) + (search-forward "macroexp--m1-tests-filename") + (makunbound 'macroexp--m1-tests-filename) + ;; `macroexp-file-name' should also work with `eval-defun'. + (eval-defun nil) + (should (equal "m1.el" + (file-name-nondirectory macroexp--m1-tests-filename)))) + + ;; Test the case where we load a file which byte-compiles another. + (defvar macroexp--m1-tests-comp-filename) + (makunbound 'macroexp--m1-tests-comp-filename) + (load (expand-file-name "m2.el" rsrc-dir)) + (should (equal "m1.el" + (file-name-nondirectory macroexp--m1-tests-comp-filename))))) + + (provide 'macroexp-tests) ;;; macroexp-tests.el ends here |