diff --git a/libraries/stdlib/src/test/Test.kt b/libraries/stdlib/src/test/Test.kt index 310cf5cf33f..e4af2cc5bb1 100644 --- a/libraries/stdlib/src/test/Test.kt +++ b/libraries/stdlib/src/test/Test.kt @@ -84,19 +84,19 @@ inline fun expect(expected: T, message: String, block: ()-> T) { } /** Asserts that given function block fails by throwing an exception */ -fun fails(block: ()-> Unit): Exception? { +fun fails(block: ()-> Unit): Throwable? { try { block() asserter().fail("Expected an exception to be thrown") return null - } catch (e: Exception) { + } catch (e: Throwable) { println("Caught excepted exception: $e") return e } } /** Asserts that a block fails with a specific exception being thrown */ -fun failsWith(block: ()-> Unit) { +fun failsWith(block: ()-> Unit) { try { block() asserter().fail("Expected an exception to be thrown")