Removing ddoc and unittest [Was: Re: How does D improve...]

Jason House jason.james.house at gmail.com
Mon Nov 10 10:26:53 PST 2008


Walter Bright Wrote:

> Experience has led me to believe that unit tests are extremely valuable, 
> but I rarely see them used - even by professionals. I wanted to make 
> them so easy to use in D that it would hook people in. That's why they 
> are the way they are - super simple, next to nothing to learn, and they 
> work.

D's unit tests are _harder_ to use when there's a failure!  Once upon a time, I upgraded to a new version of Tango.  It had undocumented breaking changes in it that broke several unit tests in the same module.  It took me a while to realize the full scope of the problem because I was unable to see the full impact of the upgrade.

I've also had issues where I've had known unit test failures while working on code.  In the interim, I'm left with two bad options:
1. Comment out the unit test
2. Stop running unit tests

I hope these two small examples give a flavor for why I'd like the ability to get status of all unit tests in a module.  

It'd be nice if one could set up test driven development with D's unit tests.  Right now, I'm in the process of making an adapter around 3 API's.  What I'd like to do is get the first API wrapped up and write a reusable tester object that works on the wrapped interface.  Then, I'd like to turn that tester on the other two API's as I wrap them and get incremental updates on what does and does not work.  For this to work, I'd want to be able to see unit test failures without stopping.  I'd also need more than just line numbers for a failure since the same test object will be used for different API's.  This applies generally to any templated object with unit tests.  With an increased number of test failures, I'll really want to start differentiating them in terms of things that I can easily read and understand.  Stuff like "Test Failure: API3: Liberties Test: Incorrect liberties after merger" etc...



More information about the Digitalmars-d mailing list