www.digitalmars.com         C & C++   DMDScript  

D - unittest results

reply Tony West <Tony_member pathlink.com> writes:
When I compile for unit tests in D (and providing none of the assertions fail),
there are no results displayed.  I find this disturbing as I do like some
positive confirmation that the tests have succeeded.

When using junit, results such as the following are displayed:

Time: 0.01

OK (6 tests)

Is it possible to get similar feedback from unit tests in D?

Thanks for any help that can be offered.

Tony
Apr 20 2004
next sibling parent Mike Swieton <mike swieton.net> writes:
On Wed, 21 Apr 2004 02:14:04 +0000, Tony West wrote:

 When I compile for unit tests in D (and providing none of the assertions fail),
 there are no results displayed.  I find this disturbing as I do like some
 positive confirmation that the tests have succeeded.
 
 When using junit, results such as the following are displayed:
 
 Time: 0.01
 
 OK (6 tests)
 
 Is it possible to get similar feedback from unit tests in D?
 
 Thanks for any help that can be offered.
 
 Tony
There's currently no way that I've seen to get any reporting out of D's built in unit tests. There is a document I posted on the newsgroup a few weeks back on that very topic; there's a link to it on the wiki in feature requests. I've not heard back from Walter on it, though. Mike Swieton __ We are all born originals - why is it so many if us die copies? - Edward Young
Apr 20 2004
prev sibling next sibling parent Ben Hinkle <bhinkle4 juno.com> writes:
Tony West wrote:

 When I compile for unit tests in D (and providing none of the assertions
 fail),
 there are no results displayed.  I find this disturbing as I do like some
 positive confirmation that the tests have succeeded.
 
 When using junit, results such as the following are displayed:
 
 Time: 0.01
 
 OK (6 tests)
 
 Is it possible to get similar feedback from unit tests in D?
 
 Thanks for any help that can be offered.
 
 Tony
I bet the unittest hooks (or lack thereof) will get another pass after 1.0. I'd like to see a standard mechanism for plugging in a custom test harness - eg pass in the name of the harness function on the command line. -Ben
Apr 21 2004
prev sibling parent "Walter" <walter digitalmars.com> writes:
"Tony West" <Tony_member pathlink.com> wrote in message
news:c64ldc$1nua$1 digitaldaemon.com...
 When I compile for unit tests in D (and providing none of the assertions
fail),
 there are no results displayed.  I find this disturbing as I do like some
 positive confirmation that the tests have succeeded.
What I do is something like you see in std.string: //debug=string; // uncomment to turn on debugging printf's ... unittest { int result; debug(string) printf("string.cmp.unittest\n"); result = cmp("abc", "abc"); assert(result == 0); result = cmp(null, null); assert(result == 0); result = cmp("", ""); assert(result == 0); result = cmp("abc", "abcd"); assert(result < 0); result = cmp("abcd", "abc"); assert(result > 0); result = cmp("abc", "abd"); assert(result < 0); result = cmp("bbc", "abc"); assert(result > 0); } You can also add at the end: debug(string) printf"string.cmp.unittest succeeded\n");
Apr 24 2004