You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When generating HTML reports and during verification, any nested classes are analyzed and displayed separately.
From the point of view of Kotlin code, this is not entirely correct, because these class-files are features of the JVM compiler implementation and do not reflect the real coverage of the Kotlin class.
It is necessary to merge coverage for the following nested classes:
companion object
lambda
anonymous object
local class
Example:
class NestedExample {
companion object {
// companion
}
private fun functionHandler(f: () -> String) {
println("result ${f()}")
}
fun handle() {
// local class
class LocalClass { }
// lambda
functionHandler {
"function"
}
// anonymous object
object: Function<String> {
override fun toString(): String = "Hi"
}
}
}
the coverage is evaluated separately for all classes, e.g.:
NestedExample line coverage: ..%
NestedExample$Companion line coverage: ..%
NestedExample$handle$1 line coverage: ..%
NestedExample$handle$2 line coverage: ..%
NestedExample$handle$LocalClass line coverage: ..%
Expected:
NestedExample line coverage: ..%
Important!
At the same time, regular nested classes and inner classes should continue to be counted separately:
class Nested2Example {
class Foo {
}
inner class Bar {
}
}
should give
Nested2Example line coverage: ..%
Nested2Example$Bar line coverage: ..%
Nested2Example$Foo line coverage: ..%
The text was updated successfully, but these errors were encountered:
When generating HTML reports and during verification, any nested classes are analyzed and displayed separately.
From the point of view of Kotlin code, this is not entirely correct, because these class-files are features of the JVM compiler implementation and do not reflect the real coverage of the Kotlin class.
It is necessary to merge coverage for the following nested classes:
Example:
the coverage is evaluated separately for all classes, e.g.:
Expected:
Important!
At the same time, regular nested classes and inner classes should continue to be counted separately:
should give
The text was updated successfully, but these errors were encountered: