stdlib: Enable assertFailsWith function
The function was disabled due to an issue with catch serialization. Now the issue is fixed and the function can be re-enabled.
This commit is contained in:
@@ -1,24 +1,5 @@
|
||||
package kotlin.test
|
||||
|
||||
// TODO: Remove it when such method from library is available.
|
||||
/** Asserts that a [block] fails with a specific exception of type [exceptionClass] being thrown. */
|
||||
inline fun <reified T : Throwable> assertFailsWith(message: String? = null, block: () -> Unit): T {
|
||||
try {
|
||||
block()
|
||||
} catch (e: Throwable) {
|
||||
if (e is T) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return e
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER")
|
||||
fail(message + ". Expected an exception of type //TODO: add type!// to be thrown, but was $e")
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER")
|
||||
fail(message + ". Expected an exception of type //TODO: add type!// to be thrown, but was completed successfully.")
|
||||
}
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
public fun assertTypeEquals(expected: Any?, actual: Any?) {
|
||||
//TODO: find analogue
|
||||
|
||||
Reference in New Issue
Block a user