Thread overview
lexer.d and unittests
Aug 05, 2019
Walter Bright
Aug 07, 2019
Jacob Carlborg
Aug 08, 2019
Walter Bright
August 05, 2019
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?
August 07, 2019
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

-- 
/Jacob Carlborg
August 07, 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.