Utah Valley University teaches D (using TDPL)
Jonathan M Davis
jmdavisProg at gmx.com
Tue Nov 16 10:54:50 PST 2010
On Tuesday, November 16, 2010 07:53:01 Sean Kelly wrote:
> bearophile Wrote:
> > He also gives a quite useful unittest that the student implementation
> > must pass, this is a good usage of unittests. The unit test ends like
> > this:
> >
> > ...
> >
> > writeln("unit test passed");
> >
> > }
> >
> > Indeed, a person needs feedback that the unittests have run (and have
> > succeed), I have used similar things in my dlbs1 (but more refined).
> > This kind of need for feedback is so natural that something like that
> > will be better somehow done on default by D.
>
> I'd like unit tests to be optionally named: unittest("name"). The rest
> could then be done in library code.
That would indeed be great. With that done, it could become possible to run unit
tests by name (though that would likely mean more changes for the compiler) in
an IDE or whatnot. There's at least one bug report suggesting it, IIRC, though I
think that it was suggested that they be named without the quotes.
unittest(name) should probably translate to something like unittest_name in
whatever scope it's in.
In any case, it's a good enhancement request that hasn't come to fruition yet.
Most of the rest (if not all of it) could indeed be done in a library. Right now
unit tests follow the unix convention of saying nothing on success, which I
think is best for the current set up - particularly when it's not all that hard
to add code yourself which prints out success if you really want it to.
- Jonathan M Davis
More information about the Digitalmars-d-announce
mailing list