On 4/3/13, Jacob Carlborg <d...@me.com> wrote: > The problem is having the unit tests in the same file. Yes, I know, most > of you love it, I don't.
One thing I noticed is that having unittests in separate files can catch issues with template mixins. If you have any private or protected functions that are used by a mixin template, the mixin template will not compile once the user tries to use it in his own code. There are workarounds, of course, like putting functions inside of the template. But the point still stands that you need to also test the library externally. Another thing local unittests don't test are symbol clashes. If a user imports lib.a and lib.b from your library, he probably doesn't expect to get symbol clashes. In fact Phobos has had symbol clashes before, and we're working on getting rid of them (e.g. through deprecation stages). But if Phobos also had external test-cases then we could have avoided symbol clashes to begin with.