How can one reliably run unittests
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Wed Aug 25 09:23:14 UTC 2021
On Wednesday, 25 August 2021 at 07:50:50 UTC, Mathias LANG wrote:
> This. I think the original implementers had a different idea of
> how things would be used. For a long time, unittests would run
> first, then the main would be called. We all know how annoying
> that was, (most) people do not want this, they wanted two
> different modes, clearly separated. I say most, because there
> are still a few hold out I think.
I think there's also a complexity that the compiler cannot know
which main to ignore (e.g. application main) versus which main to
keep (e.g. a custom-written main inserted for running unittests,
as some frameworks do).
That's surely readily solvable but it suggests that there should
be a ready way to distinguish between entry points for running an
app versus entry points for running tests (so that test-suite
implementations can override the latter and have it Just Work).
I fully agree with you and Amaury that this _should_ be solved
and that the user shouldn't have to bother with workarounds like
the one that I shared above.
More information about the Digitalmars-d
mailing list