On Friday, 24 July 2015 at 22:09:24 UTC, Artur Skawina wrote:
On 07/24/15 23:32, Jonathan M Davis via Digitalmars-d wrote:
On Friday, 24 July 2015 at 20:57:34 UTC, Artur Skawina wrote:
The difference is that right now the developer has to write a
unit-test per function that uses `hasPrefix`, otherwise the
code might not even be verified to compile. 100% unit-test
coverage is not going to happen in practice, and just like
with docs, making things easier and reducing boilerplate to a
minimum would improve the situation dramatically.
But you see. This is exactly wrong attitude. Why on earth
should we make life easier for folks who don't bother to get
100% unit test coverage?
How exactly does making it harder to write tests translate into
having better coverage? Why is requiring the programmer to
write unnecessary, redundant, and potentially buggy tests
preferable?
And how are we making it harder to write tests? We're merely
saying that you have to actually instantiate your template and
test those instantiations. If someone don't catch a bug in their
template, because they didn't try the various combinations of
stuff that it supports (and potentially verifying that it doesn't
compile with stuff that it's not supposed to support), then they
didn't test it enough. Having the compiler tell you that you're
using a function that you didn't require in your template
constraint might be nice, but if the programmer didn't catch that
anyway, then they didn't test enough. And if you don't test
enough, you're bound to have other bugs. So, the folks this helps
are the folks that aren't testing their code sufficiently and
thus likely have buggy code anyway.
- Jonathan M Davis