How to iterate through all modules for use with the new getUnitTests trait?
Dicebot
public at dicebot.lv
Thu Nov 7 04:22:21 PST 2013
On Thursday, 7 November 2013 at 08:37:02 UTC, Jacob Carlborg
wrote:
> That is the problem. One needs to import all other modules.
> That's not a good solution when creating a unit test framework.
> One would basically have to scan a directory for all D files.
> Then generate a new file that imports all these files, with a
> main function that runs all tests.
I don't see this much an issue as expect good testing framework
to be coupled with a build system anyway. Also in really _lot_ of
programs simply adding mixin to your `app.d` / `main.d` is enough
as everything else is transitively imported from there.
But in general yes, this an inherent flaw of compile-time
reflection.
> Alternatively have something like RTInfo but for modules:
>
> Bugzilla: https://d.puremagic.com/issues/show_bug.cgi?id=10023
> Pull request DMD:
> https://github.com/D-Programming-Language/dmd/pull/2271
> Pull request druntime:
> https://github.com/D-Programming-Language/druntime/pull/534
I kind of both like it and hate it. Improving runtime reflection
power is useful but it implies using special RT-tied UDA's and
won't be able to use same declarations as compile-time version.
Whatever solution is chosen for RT approach, I'd love to see it
implicit and compatible with CT one.
More information about the Digitalmars-d-learn
mailing list