Running unittests in a D library

Jacob Carlborg doob at me.com
Wed Sep 19 23:53:31 PDT 2012


On 2012-09-20 01:56, Jonathan M Davis wrote:

> Yes. But the solution then is to not unit test your library that way. You
> build it as a binary with an empty main and run that. It may be that compiling
> it as a library and then linking should work, but unless you want to have the
> unit test stuff compiled into your library normally (I wouldn't think so),
> you'll have to compile it separately for unit testing anyhow, so I don't think
> that it's really a big issue. You just have to realize that you need to not
> compile your library as a library when compiling your -unittest build.

Of course you don't want the unit tests in a release build, but when you 
explicitly build with -unittest or -debug they could be included.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list