ast icon indicating copy to clipboard operation
ast copied to clipboard

Please help by writing unit tests to fill in gaps in the code coverage

Open krader1961 opened this issue 6 years ago • 0 comments

I've been looking at the code coverage report and was surprised that module enum.c had one function, create_enum(), that was not called. Especially since there is what appears to be a relatively comprehensive unit test of the enum mechanism. In looking at that function I noticed a bug:

https://github.com/att/ast/blob/7c94951d40dc1277e2accfb430e8328a50b0b1ec/src/cmd/ksh93/bltins/enum.c#L236-L237

The bug is that the error() call results in a longjmp. Meaning control never returns to execute the return mp;. I confirmed this empirically by adding DPRINTF() statements to confirm that the function is invoked when I execute the appropriate statements and that the final return is never reached when that error condition is true.

Probably the single most useful thing people could be doing is adding tests to improve function, line, and branch coverage.

krader1961 avatar Jul 04 '19 02:07 krader1961