Companion

Default implementation of AssertionScope that throws an AssertionError when an assertion fails.

This companion object serves as the default assertion scope for top-level assertion functions.

Functions

Link copied to clipboard

Executes the given assertion checker and consumes its result.

Link copied to clipboard
open override fun consumeAssertion(assertionResult: AssertionScope.Assertion)

Consumes an assertion result, typically by throwing an AssertionError if the assertion fails.

Link copied to clipboard
fun AssertionScope.fail(message: String, cause: Throwable? = null)

Fails the current assertion scope with the given message and optional cause.

Link copied to clipboard
inline fun AssertionScope.firmly(block: context(AssertionScope) () -> Unit)
Link copied to clipboard
inline operator fun AssertionScope.invoke(block: context(AssertionScope) () -> Unit)

Invokes the given assertion block with this AssertionScope as the context receiver.

Link copied to clipboard
inline fun AssertionScope.softly(block: context(AssertionScope) () -> Unit)

Executes the given assertion block in a "soft" mode, collecting all assertion failures and reporting them together at the end.

Link copied to clipboard
inline fun AssertionScope.withClue(crossinline clue: () -> String, block: context(AssertionScope) () -> Unit)

Executes the given assertion block with a lazily-evaluated clue that is prefixed to any assertion failure messages.

inline fun AssertionScope.withClue(clue: String, block: context(AssertionScope) () -> Unit)

Executes the given assertion block with a descriptive clue that is prefixed to any assertion failure messages.