DMD: how to restore old unittest+main
H. S. Teoh
hsteoh at quickfur.ath.cx
Thu Aug 13 17:45:38 UTC 2020
On Thu, Aug 13, 2020 at 08:30:44AM +0000, Jonathan via Digitalmars-d-learn wrote:
[...]
> Is there a reason you need to run all unittests every time you want to
> run the program?
During development, this is a valuable time-saver: instead of compiling
twice, once with -unittest and once without, then running each
individually, it helps to have unittests run before main() so that any
regressions are immediately noticed, and if unittests pass, then main()
runs and manual testing can proceed.
Obviously, for release builds unittests are useless, so in that case
there's no need to include unittests before running main().
> I personally compile with -unittest to make sure all my unittests
> pass, then recompile without the -unittest flag if I actually want to
> run the program. This way, time isn't wasted running unittests every
> time the program is run.
Lots of time is wasted if you have to compile twice, once with -unittest
and once without, while you're in the code-compile-test cycle and need
to run main() for manual testing. (Not everything is testable with
unittests!)
T
--
"Holy war is an oxymoron." -- Lazarus Long
More information about the Digitalmars-d-learn
mailing list