Extending unittests [proposal] [Proof Of Concept]
Johannes Pfau
nospam at example.com
Fri Sep 21 04:31:48 PDT 2012
Am Fri, 21 Sep 2012 11:11:49 +0200
schrieb Jacob Carlborg <doob at me.com>:
> On 2012-09-20 21:11, Johannes Pfau wrote:
>
> > Oh right, I thought that interface was more restrictive. So the only
> > changes necessary in druntime are to adapt to the new compiler
> > interface.
> >
> > The new dmd code is still necessary, as it allows to access
> > all unittests of a module individually. The current code only
> > provides one function for all unittests in a module.
>
> Yes, exactly. There where some additional data, like file and module
> name as well in your compiler changes?
>
The modulename can already be obtained from the moduleinfo. My proposal
adds fileName and line information for every unittest. It's also
prepared for unittest names: The name information is passed to the
runtime, but currently it's always an empty string.
It could also allow to mark unittests as @disable, if we wanted that.
Here's the dmd pull request
https://github.com/D-Programming-Language/dmd/pull/1131
For user code, druntime changes are more interesting:
https://github.com/D-Programming-Language/druntime/issues/308
Custom test runner: http://dpaste.dzfl.pl/046ed6fb
Sample unittests: http://dpaste.dzfl.pl/517b1088
Output: http://dpaste.dzfl.pl/2780939b
More information about the Digitalmars-d
mailing list