Skip to content

Compatibility with Arrowopensavvy.prepared.compat.arrow.corecheckRaises

checkRaises

inline fun <Failure> checkRaises(expected: Failure, block: Raise<Any?>.() -> Any?)

Fails the test if block doesn't raise with expected.

Example

test("√-1 raises") {
    assertRaises(NegativeSquareRoot) {
        sqrt(-1.0)
    }
}
inline fun <Failure> checkRaises(block: Raise<Any?>.() -> Any?)

Fails the test if block doesn't raise with a value of type Failure.

Example

test("√-1 raises") {
    assertRaisesWith<NegativeSquareRoot> {
        sqrt(-1.0)
    }
}