[Issue 5587] Use __LINE__ to pick number in unittest block names
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Apr 29 13:11:29 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5587
--- Comment #8 from Andrei Alexandrescu <andrei at metalanguage.com> 2011-04-29 13:07:43 PDT ---
(In reply to comment #5)
> (In reply to comment #4)
> > > Um, have to be careful about two unittests on the same line!
> > Why? Either combine the functions into one,
>
> Which introduces a complex special case.
>
> > or disallow that possibility
> > (shouldn't be too disruptive I would think).
>
> D has no similar dependencies on line endings, this would be a bizarre
> exception.
Yah. Probably a simple practical solution is to define a name for the unittest
depending on __FILE__ and __LINE__ for single unittests, and to add a count
only for several unittests on the same line. This makes the common case simple
and the exceedingly rare exception handled with panache. For example:
unittest { a(); }
unittest { b(); } unittest { c(); }
The first unittest is "unittest at foo/bar/baz.d:238", the second unittest is
"unittest #1 at foo/bar/baz.d:239", and the third is "unittest #2 at
foo/bar/baz.d:239". That takes care of everything.
BTW Walter I appreciate you giving a look to this. It's a simple addition that
would drastically improve the conviviality of unittests.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list