diff options
author | Evgeny Mandrikov <138671+Godin@users.noreply.github.com> | 2021-04-08 11:30:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-08 11:30:06 +0200 |
commit | b68fe1a0a7fb86f12cda689ec473fd6633699b55 (patch) | |
tree | 7a6cbfe736fdeadecbfd147ea63cf94160af1dd5 /org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/targets | |
parent | 9a88237cc399ecd5ba149c56de56130bf99d0385 (diff) | |
download | jacoco-b68fe1a0a7fb86f12cda689ec473fd6633699b55.tar.gz |
Update filter for Kotlin 1.5 when-expressions with String (#1172)
Diffstat (limited to 'org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/targets')
-rw-r--r-- | org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/targets/KotlinWhenExpressionTarget.kt | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/targets/KotlinWhenExpressionTarget.kt b/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/targets/KotlinWhenExpressionTarget.kt index 882bac63..13f7e20d 100644 --- a/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/targets/KotlinWhenExpressionTarget.kt +++ b/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/targets/KotlinWhenExpressionTarget.kt @@ -50,23 +50,27 @@ object KotlinWhenExpressionTarget { else -> throw NoWhenBranchMatchedException() // assertNotCovered() } // assertFullyCovered() - private fun whenString(p: String): Int = when (p) { // assertFullyCovered(0, 5) + private fun whenString(p: String): Int = when (p) { // assertFullyCovered(0, 7) "a" -> 1 // assertFullyCovered() "b" -> 2 // assertFullyCovered() - "\u0000a" -> 3 // assertFullyCovered() - "\u0000b" -> 4 // assertFullyCovered() - else -> 5 // assertFullyCovered() + "c" -> 3 // assertFullyCovered() + "\u0000a" -> 4 // assertFullyCovered() + "\u0000b" -> 5 // assertFullyCovered() + "\u0000c" -> 6 // assertFullyCovered() + else -> 7 // assertFullyCovered() } // assertFullyCovered() /** * Unlike [whenString] * in this example first case is the only case with biggest hashCode value. */ - private fun whenStringBiggestHashCodeFirst(p: String): Int = when (p) { // assertFullyCovered(0, 4) - "b" -> 1 // assertFullyCovered() - "a" -> 2 // assertFullyCovered() - "\u0000a" -> 3 // assertFullyCovered() - else -> 4 // assertFullyCovered() + private fun whenStringBiggestHashCodeFirst(p: String): Int = when (p) { // assertFullyCovered(0, 6) + "c" -> 1 // assertFullyCovered() + "b" -> 2 // assertFullyCovered() + "\u0000b" -> 3 // assertFullyCovered() + "a" -> 4 // assertFullyCovered() + "\u0000a" -> 5 // assertFullyCovered() + else -> 6 // assertFullyCovered() } // assertFullyCovered() @JvmStatic @@ -86,13 +90,17 @@ object KotlinWhenExpressionTarget { whenString("") whenString("a") whenString("b") + whenString("c") whenString("\u0000a") whenString("\u0000b") + whenString("\u0000c") whenStringBiggestHashCodeFirst("") whenStringBiggestHashCodeFirst("a") whenStringBiggestHashCodeFirst("b") + whenStringBiggestHashCodeFirst("c") whenStringBiggestHashCodeFirst("\u0000a") + whenStringBiggestHashCodeFirst("\u0000b") } } |