usingLazily

Transforms an Expect assertion from one value type to another using a lazily-evaluated provider function.

The provider function is called lazily (only when exposeValue is first called on the result) with the current value, and the result is cached.

Return

A new Expect instance wrapping the lazily-transformed value.

Parameters

provider

A function that transforms the current value to a new value. Called at most once.

Type Parameters

OldValue

The type of the current value.

NewValue

The type of the transformed value.


inline fun <OldValue, NewValue> Expect<OldValue>.usingLazily(noinline provider: (OldValue) -> NewValue, block: Expect<NewValue>.() -> Unit)(source)

Transforms an Expect assertion from one value type to another using a lazily-evaluated provider function and executes the assertion block on the transformed value.

The provider function is called lazily with the current value, and the block is called exactly once with the transformed value as the receiver.

Parameters

provider

A function that transforms the current value to a new value. Called at most once.

block

The assertion block to execute with the lazily-transformed value as the receiver.

Type Parameters

OldValue

The type of the current value.

NewValue

The type of the transformed value.