Unittesting libraries
simendsjo
simendsjo at gmail.com
Wed Aug 10 00:11:53 PDT 2011
On 08.08.2011 14:11, simendsjo wrote:
> Is it possible to run unittests in libraries?
> The following doesn't work:
>
> l.d
> ===
> module l;
> import std.stdio;
> int f() { return 1; } // just to make sure it's actually compiled in
> unittest {
> writeln("Unittest from lib");
> assert(false);
> }
>
>
> t.d
> ===
> import l;
> import std.stdio;
> void main() {
> writeln(f());
> }
>
>
> > dmd -unittest -lib l
> > dmd -unittest t l.lib
> > t.exe
> 1
Anyone? Now I have to compile every source file from the library into
t.d instead of compiling in the library.
More information about the Digitalmars-d-learn
mailing list