Unittest

Jacob Carlborg doob at me.com
Sun Dec 16 12:02:45 PST 2012


On 2012-12-16 19:39, bioinfornatics wrote:
> Dear,
>
> I would like to understand if to have an empty main file ils need to use
> unittest.
>
> I explain i have a library with some unittest section
>
> -- foo.d--
>
> void doFoo(){ ... }
> unittest{
>    scope(success) writeln( "ok" );
>    scope(failure) writeln( "no" );
>    doFoo();
> }
> ------
>
>
> to use unittest i need to have main file which import each library
> module as
>
> --- main.d- --
> import foo1, foo2, foo3;
>
> void main(){}
> -------
>
> why they are not a dflag to do this?
>
> Maybe that is me where is use badly d unittest

You don't necessarily need to import the other files. As long as all 
files are compiled it should run the unit tests for all files.

You do need a main function.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list