Kotlin / kotlinx-kover

Apache License 2.0
1.25k stars 46 forks source link

Inline operation execution not detected #573

Open mgroth0 opened 1 month ago

mgroth0 commented 1 month ago

Describe the bug

I have discovered a case where an inline operation is not correctly detected by Kover.

Errors

This leads to errors in koverVerify if we exepct to have covered this code block.

Expected behavior

Inline operations should be detected just as non-inline operations are.

Reproducer

I will link a full reproducer project in a few minutes.

Environment

mgroth0 commented 1 month ago

Here is the reproducer: https://github.com/mgroth0/kover-573

To reproduce:

  1. ./gradlew test -i and observe that the output is
    hello test fun 1
    hello test fun 1 lambda
    hello test fun 2
    hello test fun 2 lambda
  1. ./gradlew koverVerify and observe it fails with Rule violated: lines covered percentage is 87.500000, but expected minimum is 100

  2. ./gradlew koverHtmlReport and observe in the HTML report that the line of code println("hello test fun 2 lambda") was not detected to have executed.

As the output from step 1 shows, however, the line definitely did execute.

shanshin commented 1 month ago

Error reproduced when inline function, with a call to other inline functions inside, is used directly in the test

shanshin commented 3 days ago

Depends on https://youtrack.jetbrains.com/issue/KT-68006/Full-debug-information-for-call-of-InlineOnly