unittest behaviour

H. S. Teoh hsteoh at qfbox.info
Tue Dec 17 19:56:32 UTC 2024


On Tue, Dec 17, 2024 at 07:16:55PM +0000, DLearner via Digitalmars-d-learn wrote:
[...]
> What is wrong with changing the specification of unittest so that it
> recompiles/reexecutes the associated source on every unittest {}
> block?

That means the compiler will have to rerun your program once per
unittest.  That means your OS has to create a new process per unittest.
If you have a lot of unittests, that adds a huge amount of overhead.


> That way, there would be no alteration in behaviour if the source was
> 'pure', but you would have flexibility if you wanted to test source
> that was (intentionally) 'stateful'.
[...]

It still does not solve the problem of unittests with side-effects, like
file or network I/O.


T

-- 
Did you hear about the kidnapping at school today?  Everything's OK now -- he woke up.


More information about the Digitalmars-d-learn mailing list