https://kotlinlang.org logo
Title
c

cheeze2000

06/24/2022, 1:35 PM
hello, jacoco says that this specific line has 6 branches. i can't figure out the missing branch, does anyone know?
s

Szymon Jeziorski

06/24/2022, 1:51 PM
Jacoco checks coverage on the byte code level. As Jacoco was designed to target Java it may not always produce clear or intuitive output for Kotlin code and the message you get probably is not only referring just to the line it highlights but wider context which resulted in specific bytecode. IntelliJ lets you use Show Kotlin Bytecode action when within Kotlin file, you can decompile bytecode to Java and check how your Kotlin code may look when decompiled to Java
c

cheeze2000

06/24/2022, 1:54 PM
i think i have figured it out. it compiles to
'0' <= char && char <= '9'
and my tests only covered invalid values where
char < '0'
i added tests where
char > '9'
and it covered all the brances. thanks for your help