On Sunday, 23 June 2019 at 01:26:29 UTC, Mike Brockus wrote:
I think we made a lot of progress, suddenly it's working and I
don't need to include main. Is there a way to indicate based on
console output that one executable is the tester and the other
is the application?
unittest blocks are skipped completely by the compiler when the
-unittest command line option is not passed. So you can leave
unittest code embedded in between the rest (specially for proper
unit tests of functions and classes) and there is no need to
worry about file separation. Even when you write a separate file
with tests, all its code inside unittest blocks can be skipped
for the compiler.
In the case of dub, it has a dedicated option, "dub test" instead
of "dub build" or "dub run"