[Dlang-internal] lexer.d and unittests

Walter Bright newshound2 at digitalmars.com
Thu Aug 8 00:59:30 UTC 2019


On 8/7/2019 2:52 AM, Jacob Carlborg wrote:
> On 2019-08-06 01:36, Walter Bright wrote:
>> https://codecov.io/gh/dlang/dmd/src/master/src/dmd/lexer.d
>>
>> Despite having unittests, it is only 30% covered, which is simply terrible. 
>> Anyone care to add more coverage tests?
> 
> I highly recommend adding tests like these [1]. Some more examples [2] [3].
> 
> [1] https://github.com/dlang/dmd/tree/master/test/unit/lexer
> [2] https://github.com/dlang/dmd/pull/10010
> [3] https://github.com/dlang/dmd/pull/9963
> 

I was able to fully unittest the Warp lexer without building a test harness, 
just using basic unittests:

https://github.com/facebookarchive/warp/blob/master/lexer.d#L852

In fact, Warp was the most fully unittested project I've ever done, and it had 
remarkably few bugs found in the field.


More information about the Dlang-internal mailing list