unittest behaviour
DLearner
bmqazwsx123 at gmail.com
Tue Dec 17 21:31:13 UTC 2024
On Tuesday, 17 December 2024 at 19:56:32 UTC, H. S. Teoh wrote:
[...]
>
> 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.
Agreed, but only an issue when testing, not in production.
[...]
> It still does not solve the problem of unittests with
> side-effects, like file or network I/O.
To me, it is unreasonable to expect unittest (as a part of the
compiler suite) to establish/reset those parts of the environment
outside of the program source code (like creating/restoring test
files etc).
I regard that as something that is the programmer's
responsibility [perhaps by writing a script that performs those
tasks, and calling that script within the unittest].
More information about the Digitalmars-d-learn
mailing list