diff --git a/compat/compat-arrow/src/commonMain/kotlin/core/EnsureRaises.kt b/compat/compat-arrow/src/commonMain/kotlin/core/EnsureRaises.kt index 5c157c6..aa6b6d4 100644 --- a/compat/compat-arrow/src/commonMain/kotlin/core/EnsureRaises.kt +++ b/compat/compat-arrow/src/commonMain/kotlin/core/EnsureRaises.kt @@ -36,11 +36,11 @@ inline fun checkRaises(expected: Failure, block: Raise.() -> Any either(block).fold( ifLeft = { if (it != expected) - throw AssertionError("Expected to fail with $expected, but failed with $it") + throw AssertionError("Expected to fail with $expected\nbut failed with $it") // else: successful case }, ifRight = { - throw AssertionError("Expected to fail with $expected, but the operation was successful and returned $it") + throw AssertionError("Expected to fail with $expected\nbut the operation was successful and returned $it") }, ) } @@ -62,11 +62,11 @@ inline fun checkRaises(block: Raise.() -> Any?) { either(block).fold( ifLeft = { if (it !is Failure) - throw AssertionError("Expected to fail with ${Failure::class}, but failed with $it") + throw AssertionError("Expected to fail with ${Failure::class}\nbut failed with $it") // else: successful case }, ifRight = { - throw AssertionError("Expected to fail with ${Failure::class}, but the operation was successful and returned $it") + throw AssertionError("Expected to fail with ${Failure::class}\nbut the operation was successful and returned $it") }, ) } diff --git a/compat/compat-arrow/src/commonTest/kotlin/EnsureRaisesTest.kt b/compat/compat-arrow/src/commonTest/kotlin/EnsureRaisesTest.kt index 1555eea..4780c61 100644 --- a/compat/compat-arrow/src/commonTest/kotlin/EnsureRaisesTest.kt +++ b/compat/compat-arrow/src/commonTest/kotlin/EnsureRaisesTest.kt @@ -37,7 +37,7 @@ val CheckRaisesTest by preparedSuite { 5 } } - check(e.message matches "Expected to fail with .*(Any|Object).*, but the operation was successful and returned 5") + check(e.message matches "Expected to fail with .*(Any|Object).*\nbut the operation was successful and returned 5") } test("Throws when the wrong thing is raised") { @@ -46,7 +46,7 @@ val CheckRaisesTest by preparedSuite { raise(6) } } - check(e.message matches "Expected to fail with 5, but failed with 6") + check(e.message matches "Expected to fail with 5\nbut failed with 6") } test("Throws when nothing is raised") { @@ -55,7 +55,7 @@ val CheckRaisesTest by preparedSuite { 5 } } - check(e.message matches "Expected to fail with .*(Any|Object).*, but the operation was successful and returned 5") + check(e.message matches "Expected to fail with .*(Any|Object).*\nbut the operation was successful and returned 5") } test("Throws when the wrong thing is raised") { @@ -64,7 +64,7 @@ val CheckRaisesTest by preparedSuite { raise(6) } } - check(e.message matches "Expected to fail with 5, but failed with 6") + check(e.message matches "Expected to fail with 5\nbut failed with 6") } }