Skip to content

Commit

Permalink
WIP Extract configuration logic
Browse files Browse the repository at this point in the history
TODO
- Readme module.
- iterationFailures unused?
- remove check failure in next commit?
- check if PException was caught on next iteration
- configured shouldn't catch PException
- vanilla `parameterize` docs, and other configuration docs
- merge iterator -> state (vanilla & configured)

Improves performance of unconfigured parameterize, and greatly simplifies core logic
configuration may be dropped later
  • Loading branch information
BenWoodworth committed Oct 25, 2024
1 parent c915ee6 commit 9984d12
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.benwoodworth.parameterize

import com.benwoodworth.parameterize.ParameterizeConfiguration.*
import com.benwoodworth.parameterize.test.configuredParameterizeExitingBlockEdgeCases
import com.benwoodworth.parameterize.test.testAll
import kotlin.coroutines.RestrictsSuspension
import kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED
Expand Down Expand Up @@ -129,20 +128,21 @@ class ParameterizeConfigurationSpec_decorator {
}

@Test
fun iteration_function_should_return_regardless_of_how_parameterize_block_is_exited() = testAll(
configuredParameterizeExitingBlockEdgeCases
) { parameterizeExitingBlock ->
fun iteration_function_should_return_regardless_of_how_parameterize_block_is_exited() {
var returned = false

val configuration = ParameterizeConfiguration {
decorator = { iteration ->
iteration()
returned = true
run exitLoop@{
parameterize(
decorator = { iteration ->
iteration()
returned = true
}
) {
// A non-local return ensures that all types of loop exits will be handled (with a `finally` block)
return@exitLoop
}
}

parameterizeExitingBlock(configuration)

assertTrue(returned, "returned")
}

Expand Down

0 comments on commit 9984d12

Please sign in to comment.