unittests, dub and libraries
Jesse Phillips
Jesse.K.Phillips+D at gmail.com
Wed Mar 28 21:29:22 UTC 2018
On Wednesday, 28 March 2018 at 03:07:23 UTC, Jonathan M Davis
wrote:
> Run
>
> dub test
>
> The problem is that an executable needs a main, and a library
> doesn't have one, whereas when you're testing a library, you
> need an executable. So, a main must be inserted - e.g. with the
> -main flag to dmd. Just building the unittest build doesn't
> insert one. However, dub test _does_ deal with that for you.
>
> - Jonathan M Davis
And a note on the reverse, if you have an executable project $
dub test won't build in the app.d file since it contains main and
dub test wants to avoid running your main function.
More information about the Digitalmars-d-learn
mailing list