I'm new to using ERT for testing my Elisp code, and I have a question that doesn't seem to be covered in the manual: according to best practices, where does one typically put the ERT tests? Do they go at the end of the elisp file that is to be tested, or should I put them in a separate file? I'm sure they'll work either way, but is one or the other preferred?
I would place the tests in a
test directory and name it
Using a test directory is especially useful if the tests require auxiliary files.
Another advantage is that it simplifies the MELPA recipe, as subdirectories aren't included by default.
For an example of a package with relative complex tests, you can take a look at my font-lock rules for CMake: https://github.com/Lindydancer/cmake-font-lock