lunarmodules / luacov

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

Support branch code coverage #90

Open ligurio opened 3 years ago

ligurio commented 3 years ago

Is it possible to add support of branch coverage to luacov? Right now luacov supports only coverage by statements and coverage by paths (#49) and branch coverage would be interesting too.

hishamhm commented 3 years ago

Unfortunately, I don't think it's viable. We collect information based on what the Lua debug library provides, and it is not fine-grained at the branch level. Its finest grain is at VM instruction level, but would try to map each single instruction back to the Lua source code branches, and that would be implementation-dependent based on the Lua compiler code generation, which can change on each minor release; it doesn't sound very feasible.

I'd love to be proven wrong by a PR though! :)