Hack to name unit tests?

Daniel Keep daniel.keep.lists at gmail.com
Thu Nov 29 22:48:01 PST 2007



Christopher Wright wrote:
> ...
> There are advantages to throwing an exception when registering the name:
> 
> unittest {
>    testName("this is the test that doesn't end");
>    while (true) {}
> }
> 
> I was thinking that AssertionErrors couldn't be caught, but that was an
> error on my part.

How is an exception an advantage in that case?  When you run the test,
it's still going to spinlock, no matter how you've obtained the name.

If what you're trying to get at is that you can build a list of all the
names without having to run the actual test itself, then yes, I can see
that being an advantage.

	-- Daniel



More information about the Digitalmars-d mailing list