Function: ert-resource-directory
ert-resource-directory is a macro defined in ert-x.el.gz.
Signature
(ert-resource-directory)
Documentation
Return absolute file name of the resource (test data) directory.
The path to the resource directory is the "resources" directory in the same directory as the test file this is called from.
If that directory doesn't exist, find a directory based on the test file name. If the file is named "foo-tests.el", return the absolute file name for "foo-resources".
If you want a different resource directory naming scheme, set the
variable ert-resource-directory-format. Before formatting, the
file name will be trimmed using string-trim with arguments
ert-resource-directory-trim-left-regexp and
ert-resource-directory-trim-right-regexp.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/ert-x.el.gz
;; Has to be a macro for `load-file-name'.
(defmacro ert-resource-directory ()
"Return absolute file name of the resource (test data) directory.
The path to the resource directory is the \"resources\" directory
in the same directory as the test file this is called from.
If that directory doesn't exist, find a directory based on the
test file name. If the file is named \"foo-tests.el\", return
the absolute file name for \"foo-resources\".
If you want a different resource directory naming scheme, set the
variable `ert-resource-directory-format'. Before formatting, the
file name will be trimmed using `string-trim' with arguments
`ert-resource-directory-trim-left-regexp' and
`ert-resource-directory-trim-right-regexp'."
`(let* ((testfile ,(or (macroexp-file-name)
buffer-file-name))
(default-directory (file-name-directory testfile)))
(file-truename
(if (file-accessible-directory-p "resources/")
(expand-file-name "resources/")
(expand-file-name
(format ert-resource-directory-format
(string-trim testfile
ert-resource-directory-trim-left-regexp
ert-resource-directory-trim-right-regexp)))))))