On Friday, 25 October 2013 at 16:43:23 UTC, Daniel Davidson wrote:
On Friday, 25 October 2013 at 14:14:39 UTC, Dicebot wrote:
This will work starting with 2.064:
Ok. I'll keep pressing. Here is an updated version:
http://pastebin.com/g6FWsTkr
The idea is to be able to just import ut, annotate as you have
described and get unit tests run. I want to mixin the
equivalent of your "main" in each module that just pulls in a
module constructors to evaluate what tests are there. The code
in the paste crashes on the call to getUnitests.
If I comment out `alias tests =
TypeTuple!(__traits(getUnitTests, mod));` then I see similar
call to `alias members = TypeTuple!(__traits(allMembers,
mod));` work just fine.
Is this the right way to use this? Any pointers on the
segmentation fault?
Thanks
Dan
Ok, binary reduction has shown the seg fault was due to a debug
import. This code causes a crash for me - just because of the
getUnittests. If I remove the debug import it works. Since I use
debug imports in general, I'm not so sure it is worthwhile to
pursue the named unit test approach at this time.
import std.typetuple;
import std.stdio;
debug import std.datetime;
unittest { writeln("In Test!!"); }
mixin("alias mod = " ~ __MODULE__ ~ ";");
alias tests = TypeTuple!(__traits(getUnitTests, mod));
static this() {
writeln("Done");
}
Thanks
Dan