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 19, 2024
1 parent d04ce73 commit f7e7279
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,24 @@ import com.benwoodworth.parameterize.test.WasmJsIgnore
import com.benwoodworth.parameterize.test.WasmWasiIgnore
import com.benwoodworth.parameterize.test.stackTraceLines
import kotlin.properties.PropertyDelegateProvider
import kotlin.properties.ReadOnlyProperty
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotEquals

class ParameterizeFailedErrorSpec {
private val arguments = buildList {
parameterize {
val propertyA by PropertyDelegateProvider<Nothing?, DeclaredParameter<String>> { thisRef, property ->
parameterOf("argumentA")
.provideDelegate(thisRef, property)
.also { add(it) }

// Intercept constructed ParameterDelegates so they can be used in failures
val propertyA by ReadOnlyProperty { _, property ->
parameterOf("argumentA").provideDelegate(null, property)
}
val propertyB by PropertyDelegateProvider<Nothing?, DeclaredParameter<String>> { thisRef, property ->
parameterOf("argumentB")
.provideDelegate(thisRef, property)
.also { add(it) }

val propertyB by ReadOnlyProperty { _, property ->
parameterOf("argumentA").provideDelegate(null, property)
}

add(propertyA.argument)
add(propertyB.argument)
}
}

Expand Down

0 comments on commit f7e7279

Please sign in to comment.