1 import core
.runtime
, core
.time
: MonoTime
;
2 import core
.stdc
.stdio
;
4 ModuleInfo
* getModuleInfo(string name
)
6 foreach (m
; ModuleInfo
)
7 if (m
.name
== name
) return m
;
8 assert(0, "module '"~name
~"' not found");
13 return Runtime
.args
.length
> 1 ?
testModules() : printAll();
22 foreach(name
; Runtime
.args
[1..$])
24 immutable pkg
= ".package";
25 immutable pkgLen
= pkg
.length
;
27 if (name
.length
> pkgLen
&& name
[$ - pkgLen
.. $] == pkg
)
28 name
= name
[0 .. $ - pkgLen
];
30 doTest(getModuleInfo(name
), ret);
38 foreach (m
; ModuleInfo
)
43 printf("%.*s\n", cast(int)name
.length
, name
.ptr
);
50 void doTest(ModuleInfo
* moduleInfo
, ref bool ret)
52 if (auto fp
= moduleInfo
.unitTest
)
54 auto name
= moduleInfo
.name
;
57 immutable t0
= MonoTime
.currTime
;
59 printf("%.3fs PASS %.*s %.*s\n",
60 (MonoTime
.currTime
- t0
).total
!"msecs" / 1000.0,
61 cast(uint)mode
.length
, mode
.ptr
,
62 cast(uint)name
.length
, name
.ptr
);
66 auto msg
= e
.toString();
67 printf("****** FAIL %.*s %.*s\n%.*s\n",
68 cast(uint)mode
.length
, mode
.ptr
,
69 cast(uint)name
.length
, name
.ptr
,
70 cast(uint)msg
.length
, msg
.ptr
);
81 import core
.runtime
: dmd_coverSetMerge
;
82 dmd_coverSetMerge(true);
84 Runtime
.moduleUnitTester
= &tester
;
87 else mode
= "release";
88 static if ((void*).sizeof
== 4) mode
~= "32";
89 else static if ((void*).sizeof
== 8) mode
~= "64";
90 else static assert(0, "You must be from the future!");