About the Expressiveness of D
Jacob Carlborg
doob at me.com
Wed Apr 3 00:06:55 PDT 2013
On 2013-04-03 08:45, Andrej Mitrovic wrote:
> 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.
I didn't think about that.
> 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.
Most likely not, but there's nothing wrong with it. We do have modules
for a reason. It's fairly easy do solve for the user if the issue comes
up. If there are some common names that always clash, then there are
some problems.
> 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.
I don't know if that's something unit tests should explicitly test for.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list