shared
fun <T> shared(context: CoroutineContext = EmptyCoroutineContext, display: Display = Display.Short, block: suspend () -> T): SharedProvider<T>(source)
Declares a lazily-computed value that is constructed by calling block, and is then shared between all tests.
Most of the time, prepared should be preferred to this helper. To learn why, see Shared.
The shared value returned by this function is automatically named after the variable it is stored in.
For more information, see Shared.
Example
val precompute by shared { longRunningOperation() }
Content copied to clipboard
fun <T> shared(name: String, context: CoroutineContext = EmptyCoroutineContext, display: Display = Display.Short, block: suspend () -> T): Shared<T>(source)
Declares a lazily-computer value called name that is constructed by calling block, and is then shared between all tests.
Most of the time, prepared should be preferred to this helper. To learn why, see Shared.
For more information, see Shared.
Example
val precompute by shared("A costly operation") { longRunningOperation() }
Content copied to clipboard