Am 09.12.2013 18:29, schrieb Kapps:
> On Monday, 9 December 2013 at 12:46:00 UTC, Kapps wrote:
>> I was looking for something similar to dub test and am glad to see it
>> added, but I can't seem to figure out how to get it to do anything at
>> all.
> 
> Okay, it seems that this was just an issue with the beta. Building from
> git master allows me to run "dub test" on an executable or a library
> that has a main function within app.d. It would be nice to have an
> automated way of running unit tests for all modules within a library
> with a main file automatically generated. Even more awesome if there was
> a way to integrate with tested to perform the tests. Perhaps for the
> latter I could determine all files in the library with dub describe,
> generate an app.d that calls tested's unit test runner on each, and then
> put that app.d inside the library's source folder before invoking dub test.

The latest GIT master version now works without requiring a main file.
Regarding integration with "tested", what should work now is to import
the automatically generated module "test_main" and use that as the
testing root:

---
import test_main;

shared static this()
{
    import core.runtime;
    Runtime.moduleUnitTester = () => true;
}

void main()
{
    enforce(runUnitTests!test_main(new ConsoleTestResultWriter), "Unit
tests failed.");
}
---

Reply via email to