LuaCov marks certain lines as uncovered when they are clearly covered
Here is some Lua code with examples:
function test1()
local thing = nil -- MISSED BY LUACOV
print("test1")
end
test1()
function test2()
local stuff = function (x) return x end
local thing = stuff({
b = { name = 'bob',
},
-- comment
}) -- MISSED BY LUACOV
print("test2")
end
test2()
function test3()
if true then -- MISSED BY LUACOV
print("test3")
end
end
test3()
function test4()
while true do -- MISSED BY LUACOV
print("test4")
break
end
end
test4()
Thank you for the test case! Fixed in the current upstream repository of luacov at keplerproject/luacov
Great, thanks a ton for fixing this.
test2, test3, test4 appear to be fixed - thanks!
test1 is still being missed.
I've got Lua 5.1.5 on OS X Mavericks if that makes any difference.
That works differently in Lua 5.1 and 5.2... it's a bit harder to fix without risking to add exclusions that overreach.
Good to know, thanks for checking. Could there be a comment keyword like "--LUACOV:IGNORE" that could be added for quirks or the occasional line of code that I don't want marked?
Here's another example:
function test5()
if true then if true then -- MISSED BY LUACOV
print("test5")
end end -- MISSED BY LUACOV
end
test5()
Thanks for the feedback. LuaCov won't detect constructs like this as long as we're doing a simple line-per-line scan and not a full-fledged syntax tree analysis. It's easy to create synthetic examples like this that make it break. I think the simplicity of a no-dependencies module is worth the lack of robustness in those corner cases.