Thanks to visit codestin.com
Credit goes to github.com

Skip to content

When expression is not covered for an enum with single element in Kotlin #1748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
shanshin opened this issue Oct 15, 2024 · 0 comments · May be fixed by #1756
Open

When expression is not covered for an enum with single element in Kotlin #1748

shanshin opened this issue Oct 15, 2024 · 0 comments · May be fixed by #1756
Assignees
Milestone

Comments

@shanshin
Copy link

For the following src/Example.kt

enum class SingleEnum {
    First
}



fun testEnum(p: SingleEnum) = when (p) {
    SingleEnum.First -> 1
}

fun main() {
    testEnum(SingleEnum.First)
}

execution of

kotlin-2.0.21/bin/kotlinc src -d classes
java -javaagent:jacoco-0.8.13-SNAPSHOT/lib/jacocoagent.jar -cp classes:kotlin-2.0.21/lib/kotlin-stdlib.jar ExampleKt
java -jar jacoco-0.8.13-SNAPSHOT/lib/jacococli.jar report jacoco.exec --classfiles classes --sourcefiles src --html report

produces report
Screenshot 2024-10-15 at 17 46 16
Screenshot 2024-10-15 at 17 46 23

Expected behaviour

All lines of when expression should be fully covered as single enum element was passed

Environment

  • JaCoCo version: actual master branch built locally
  • Kotlin 2.0.21
  • Operating system: MacOS 15
  • Tool integration: CLI
@shanshin shanshin added the type: bug 🐛 Something isn't working label Oct 15, 2024
@Godin Godin added this to Filtering Oct 15, 2024
@github-project-automation github-project-automation bot moved this to Awaiting triage in Filtering Oct 15, 2024
@Godin Godin self-assigned this Oct 15, 2024
@Godin Godin moved this from Awaiting triage to To Do in Filtering Oct 15, 2024
@Godin Godin added this to the 0.8.13 milestone Oct 17, 2024
@Godin Godin moved this from To Do to In Progress in Filtering Oct 17, 2024
@Godin Godin modified the milestones: 0.8.13, 0.8.14 Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants