Subject: Re: bug#76674: Install tests for rst-mode.el in emacs.git

From: Stefan Kangas <[email-masked]>
Date: Wed, 19 Mar 2025 15:01:54 -0700

Hi Stefan,

Stefan Merten <[email-masked]> writes:

> 2 weeks (15 days) ago Stefan Kangas wrote:
>> I see that you have many tests for rst-mode.el here:
>> https://sourceforge.net/p/docutils/code/HEAD/tree/trunk/docutils/tools/editors/emacs/tests/
>>
>> However, we currently have no tests for rst-mode.el running in
>> emacs.git.  I think it would be good to create a new file
>> rst-mode-tests.el and to put all or some of your tests there.
>
> When I started those tests many years ago I looked for a place to put
> them in the Emacs repository. Then I did not found any place for it.
>
> These tests are based on ert and include some extensions for ert which
> IMHO are useful on their own. I'd love to share this but still have no
> idea where to put them.
>
> Any idea? A single file makes no sense since it is really a big suite.

We don't have anything established for this case, I think, so we have to
be a bit creative.

To be honest, I think whatever solution you can come up with that is
reasonably clean is okay.  There is always value in having the tests;
we can refactor later if we think of a better structure.

One idea is to follow the pattern established by ERC, i.e.

    test/lisp/erc/*.el

For rst.el, perhaps we could use something like

    test/lisp/textmodes/rst/*.el

That said, I didn't check if files structured like that would get picked
up automatically by the Makefile.  If it doesn't and it's too tedious to
add, one workaround could be to add a top-level file

    test/lisp/textmodes/rst-tests.el

that would then load the appropriate test files in the subdirectory.
Again, we can restructure later.  Installing the tests is the important
part, IMO.

For test data, see `ert-resource-file` and `ert-resource-directory`.

Finally, also consider using :expensive where appropriate.

Thanks for looking into this.