using

infix fun <Value> Expect.Companion.using(provider: () -> Value): Expect<Value>(source)

Creates an Expect assertion using a value provider function.

The value is obtained by calling the provider function. This allows for lazy evaluation of the value at the time the assertion is created.

Return

An Expect instance wrapping the provided value.

Parameters

provider

A function that provides the value to assert on.

Type Parameters

Value

The type of the value being asserted on.


inline fun <Value> Expect.Companion.using(noinline provider: () -> Value, block: Expect<Value>.() -> Unit)(source)

Creates an Expect assertion using a value provider function and executes the assertion block on it.

The value is obtained by calling the provider function, and the block is called exactly once with the provided value as the receiver.

Parameters

provider

A function that provides the value to assert on.

block

The assertion block to execute with the provided value as the receiver.

Type Parameters

Value

The type of the value being asserted on.


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

The provider function is called with the current value (obtained via exposeValue) and the result is wrapped in a new Expect instance.

Return

A new Expect instance wrapping the transformed value.

Parameters

provider

A function that transforms the current value to a new value.

Type Parameters

OldValue

The type of the current value.

NewValue

The type of the transformed value.


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

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

The provider function is called 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.

block

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

Type Parameters

OldValue

The type of the current value.

NewValue

The type of the transformed value.