diff options
author | Yuuki Harano <masm+github@masm11.me> | 2021-03-08 21:20:54 +0900 |
---|---|---|
committer | Yuuki Harano <masm+github@masm11.me> | 2021-03-08 21:20:54 +0900 |
commit | 4dda6db3abf4a67455a007d28e14d62a9909f665 (patch) | |
tree | 88d4e316e81f5bdd8b6801ff89ea68cd164e4055 /test/lisp/emacs-lisp/macroexp-tests.el | |
parent | 565995d408ca65ec9f981f175cca29d2164a5fd0 (diff) | |
parent | 432c1aaa80ce109250a93f50858a03ce3d01ca34 (diff) | |
download | emacs-4dda6db3abf4a67455a007d28e14d62a9909f665.tar.gz emacs-4dda6db3abf4a67455a007d28e14d62a9909f665.tar.bz2 emacs-4dda6db3abf4a67455a007d28e14d62a9909f665.zip |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs into feature/pgtk
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 |