Bug fixes must come with unit tests

Ali Çehreli acehreli at yahoo.com
Thu Feb 24 09:47:11 PST 2011


I notice that some dmd and Phobos bugs are fixed without any supporting 
unit tests.

The following approach is very effective in code quality:

1) A bug is discovered; two issues are exposed:

   i) the bug itself

  ii) the lack of a unit test that could have caught the bug

2) Write a unit test that exposes the bug

3) Finally make corrections to the code to pass the unit tests

There are cases where it is not practical but the approach above is very 
effective in reducing regressions.

Ali


More information about the Digitalmars-d mailing list