Thread overview
unittest results
Apr 21, 2004
Tony West
Apr 21, 2004
Mike Swieton
Apr 21, 2004
Ben Hinkle
Apr 24, 2004
Walter
April 21, 2004
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


April 21, 2004
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

April 21, 2004
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
April 24, 2004
"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");