lunarmodules / luacov

LuaCov is a simple coverage analyzer for Lua code.
http://lunarmodules.github.io/luacov/
MIT License
300 stars 68 forks source link

exclude goto statements and labels from accounting #89

Closed myk002 closed 8 months ago

myk002 commented 3 years ago

In Lua 5.1.5 at least, goto statements and target labels are never accounted as having coverage, even if the surrounding code coverage makes it obvious that the line has been hit. This artificially lowers the code coverage metric.

The following two lines added to any_hits_exclusions or zero_hits_exclusions fixes the issue for me:

"goto [%w_]+", -- goto statements
"::[%w_]+::", -- labels

but I don't know if there are differences on other platforms/Lua implementations.

hishamhm commented 8 months ago

Fixed in #95!