Stream: t-compiler/rust-analyzer

Topic: test functions naming convention


Lukas Wirth (Nov 09 2020 at 18:34, on Zulip):

This might be a good addition to the style guide, assuming it matters, but should unit #[test] functions be prefixed with test_? Just realized that sometimes they are prefixed and sometimes they aren't

matklad (Nov 09 2020 at 21:20, on Zulip):

I am undecided on this one

matklad (Nov 09 2020 at 21:21, on Zulip):

One one hand, test_ is unneeded, because it duplicates #[test]. On the other hand, looking for workspace symbols with test_ is convenient. On the third hand, there really should be a "look only in tests/only not in tests" checkbox for worksacpace search

matklad (Nov 09 2020 at 21:22, on Zulip):

Is there some ecosystem-wide convention for this?

Lukas Wirth (Nov 09 2020 at 21:27, on Zulip):

I don't think there is a convention for this. The book chapter regarding testing doesn't prefix with test_ which is the only place that comes to mind as some kind of reference point.

Last update: Jul 29 2021 at 08:15UTC