1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-03-05 15:05:48 +02:00

Tighten limits on code coverage context selection.

If the last } of a function was marked as uncovered then the context selection would overrun into the next function.

Start checking context on the current line to prevent this.  Make the same change for start context even though it doesn't seem to have an issue.
This commit is contained in:
David Steele 2018-11-13 10:37:58 -05:00
parent 086bc35ddc
commit acb579c469

View File

@ -178,7 +178,7 @@ sub coverageGenerate
foreach my $iLine (sort(keys(%{$rhCoverage->{$strFile}{line}})))
{
# Run back to the beginning of the function comment
for (my $iLineIdx = $iLine - 1; $iLineIdx >= 0; $iLineIdx--)
for (my $iLineIdx = $iLine; $iLineIdx >= 0; $iLineIdx--)
{
if (!defined($rhCoverage->{$strFile}{line}{sprintf("%09d", $iLineIdx)}))
{
@ -189,7 +189,7 @@ sub coverageGenerate
}
# Run forward to the end of the function
for (my $iLineIdx = $iLine + 1; $iLineIdx < @stryC; $iLineIdx++)
for (my $iLineIdx = $iLine; $iLineIdx < @stryC; $iLineIdx++)
{
if (!defined($rhCoverage->{$strFile}{line}{sprintf("%09d", $iLineIdx)}))
{