diff --git a/src/commonTest/kotlin/test/parameterizeTest.kt b/src/commonTest/kotlin/test/parameterizeTest.kt index b4279b4e..731b2a99 100644 --- a/src/commonTest/kotlin/test/parameterizeTest.kt +++ b/src/commonTest/kotlin/test/parameterizeTest.kt @@ -3,14 +3,13 @@ package net.benwoodworth.knbt.test import com.benwoodworth.parameterize.ExperimentalParameterizeApi import com.benwoodworth.parameterize.ParameterizeScope import com.benwoodworth.parameterize.parameterize -import kotlin.test.DefaultAsserter.fail inline fun parameterizeTest( recordFailures: Long = 10, maxFailures: Long = Long.MAX_VALUE, block: ParameterizeScope.() -> Unit ) { - var emptyTest = true + var hasTestCases = false parameterize( onFailure = { @@ -19,12 +18,12 @@ inline fun parameterizeTest( } ) { block() - emptyTest = false + hasTestCases = true } - if (emptyTest) { - fail("Bad parameterized test: All test cases skipped") - } + // There were no failures if it made it to this point, but check + // just in case all test cases were skipped to empty parameters. + check(hasTestCases) { "Bad parameterized test: All test cases skipped" } } @OptIn(ExperimentalParameterizeApi::class)