Open argos83 opened 7 years ago
Hi @argos83! This problem in general is relatively difficult to detect: it's specific to LuaJIT IIRC, and simply filtering out misses on such lines is sometimes wrong because fieldname = "value"
is valid outside tables and shouldn't be filtered out.
Does the problem go away when running luacov with cluacov installed?
Hey @mpeterv, I've just tried with cluacov and the same issue occurs.
That's strange. cluacov fixed it for me. What version of Lua/LuaJIT are you using? I see that the first line of your example is executed 11 times so it must be a part of a larger snippet, does the issue occur when running just the example?
Hey @mpeterv. It also happens when running just the example:
1 local sometable = {
['a'] = 'A',
['b'] = 'B',
***0 ['c'] = 'C'
}
I'm running lua in the context of OpenResty (v 1.11.2.2) compiled with --with-luajit
which I think installs LuaJIT 2.1
Erm... I had the exact opposite issue, where the last line would be considered uncovered only if adding a trailing comma
t = {
1 a.b,
1 a.c,
1 a.d,
**0 a.e,
1 }
I guess I shouldn't open a new issue and add my case here instead?
Did somebody send a PR trying to fix this issue, resulting in the opposite issue?
Hi!
When defining a table in multiple lines, LuaCov misses coverage on the last entry unless it has a trailing comma.
E.g. Without trailing comma:
With trailing comma:
Thanks for this great library!