So yes. I’ve found this problem to be more general – specifically, I would like to know, for a given part of the language, what tests it. And it’s hard to do. Basically, I consider our test suite “write only” – if I’m unsure, I just add more tests. That seems bad.
My first thought to was organize everything by directory. But the truth is that there are many ways you may want to categorize tests, and a single test often tests many things. So then I thought we should allow you to label tests with a category:
// category: foo bar
And have some tool that will tell you all the tests in a given category.
I’ve also had the, more general, though that it’d be nice to be able to do (relatively) reliable cross-referencing between files in the codebase. For example, I sometimes embed test names into the code, or other paths, only to find that someone renames the test. I was imaging instead that you could use hashtags like #foo in a comment, and a tidy script would complain if a hashtag is used in only one file in the code. It might allow you to write a filename, like #foo-bar.rs and that would be ok, so long as a file with that name exists.
So, this way, I could add a comment in the code like
// For tests, see the #borrowck-foo-bar.rs test.
and then be sure that there is a file with that name. (If the file is renamed, the renamer will have to fix the link; if it is deleted, they can fix the comment in some way.)