Rant after trying Rust a bit

Justin Whear via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 24 15:58:21 PDT 2015


On Fri, 24 Jul 2015 22:07:12 +0000, Jonathan M Davis wrote:

> On Friday, 24 July 2015 at 21:48:23 UTC, Tofu Ninja wrote:
>> On Friday, 24 July 2015 at 21:32:19 UTC, Jonathan M Davis wrote:
>>> 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?
>>
>> Because that is 99% of D users...
> 
> If so, they have no excuse. D has made it ridiculously easy to unit test
> your code. And I very much doubt that 99% of D users don't unit test
> their code.
> 
> There are cases where 100% isn't possible - e.g. because of an assert(0)
> or because you're dealing with UI code or the like where it simply isn't
> usable without running the program - but even then, the test coverage
> should be as close to 100% as can be achieved, which isn't usually going
> to be all that far from 100%.
> 
> We should be ashamed when our code is not as close to 100% code coverage
> as is feasible (which is usually 100%).
> 
> - Jonathan M Davis

Commercial (though in-house) D library and tools writer here.  We run 
code-coverage as part of our CI process and report results back to Gitlab 
(our self-hosted Github-like).  Merge requests all report the code 
coverage of the pull (haven't figured out how to do a delta against the 
old coverage yet).  I regularly test code to 100% of coverable lines, 
where coverable lines are all but:
  assert(0, ...)
  Test case lines that aren't supposed to execute (e.g. lambdas in a 
predSwitch)

I agree that there's really no excuse and think we ought to orient the 
language towards serious professionals who will produce quality code.  
Bad code is bad code, regardless of the language.


More information about the Digitalmars-d mailing list