Re: [PATCH v3 3/7] unit-tests: add for_test
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jul 26, 2024, 12:56 UTC
- Message-ID
- <ZqOc9vxdD4qttkFs@tanuki>
- In-Reply-To
- <xmqqv80szxgw.fsf@gitster.g>
On Thu, Jul 25, 2024 at 07:41:19PM -0700, Junio C Hamano wrote:
Show 22 quoted lines
> Kyle Lippincott <spectral@google.com> writes: > > >> > Maybe it's because I'm coming from a C++ environment at > >> > $JOB that's using Google's gunit and gmock frameworks, where every > >> > test is in its own function and we usually don't even write the main > >> > function ourselves, but I have a preference for the separate > >> > functions. > >> > >> If we do not have to write the main at all, then it would make the > >> separate function that implements a single test a lot more palatable, > >> and we do not even have to implement and call TEST() macro ;-). > > ... > > I tried to think of a way to do > > this, and they all involved some other system coming along and > > identifying the tests and code-generating a main function, which also > > seems like too much magic to me. > > I thought that automatically generating the boilerplates from the > visible list of test functions and piecing them together with a > synthetic main was what was brought up as how libgit2 project does > this? It does not sound all that involved and I do not find it a > rocket science.
As I said when mentioning how libgit2 does it, I'd be happy to present a working prototype for this if others think it was potentially useful. Until now I didn't hear any positive feedback thoguh, you're the first one saying that this might be something that is worth doing.
I just want to avoid wasting time on something that has no chance of landing in the first place.
Patrick