dart-lang / tools

This repository is home to tooling related Dart packages.
BSD 3-Clause "New" or "Revised" License
30 stars 24 forks source link

Some lines are executed but not shown as covered. #475

Open adrianboyko opened 3 years ago

adrianboyko commented 3 years ago

In the image below, lines 181, 184, and 187 are showing as not covered by my tests but the tests specifically test the correct execution of those lines. To verify that there wasn't a problem in my tests, I set breakpoints on those lines and noted that they are hit when I run the tests under debug. As a final check, I added the print statement on line 180 so I would have a visual verification that line 180 is being executed during testing from the command line.

coverage_result

Here's the output I see at the command line:

coverage_run

Note that the stack trace reports that line 180 did, in fact run.

Here's what it says in lcov.info for that run:

DA:175,1
DA:176,2
DA:177,2
DA:178,2
DA:179,2
DA:180,0   <-- We see the output of line 180 in the image above but it is zero here.
DA:181,0
DA:183,2
DA:184,0
DA:186,2
DA:187,0

The same thing happens at another point in my code:

other_bad_coverage

It's interesting that the coverage problem only happens in the immediate vicinity of a call to wipRec._addIssue(...). Coverage indicates that _addIssue is running even though it is only called from the lines above, which coverage says are not running.

Any idea what might be going on here? Looks like a bug to me.

JeanPSF commented 2 years ago

Is it the same problem I am running into? https://github.com/dart-lang/tools/issues/506