Skip to content

Commit

Permalink
Tighten limits on code coverage context selection.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dwsteele committed Nov 13, 2018
1 parent 086bc35 commit acb579c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/lib/pgBackRestTest/Common/CoverageTest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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)}))
{
Expand All @@ -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)}))
{
Expand Down

0 comments on commit acb579c

Please sign in to comment.