Implement proper script runtime exception rendering with tests
#KT-42335 fixed
This commit is contained in:
+17
@@ -87,6 +87,22 @@ class ReplTest : TestCase() {
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testEvalWithExceptionWithCause() {
|
||||
checkEvaluateInRepl(
|
||||
sequenceOf(
|
||||
"""
|
||||
try {
|
||||
throw Exception("Error!")
|
||||
} catch (e: Exception) {
|
||||
throw Exception("Oh no", e)
|
||||
}
|
||||
""".trimIndent()
|
||||
),
|
||||
sequenceOf(Exception("Oh no", Exception("Error!")))
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testEvalWithErrorWithLocation() {
|
||||
checkEvaluateInReplDiags(
|
||||
@@ -240,6 +256,7 @@ class ReplTest : TestCase() {
|
||||
is ResultValue.Error -> Assert.assertTrue(
|
||||
"#$index: Expected $expectedVal, got Error: ${actualVal.error}",
|
||||
expectedVal is Throwable && expectedVal.message == actualVal.error.message
|
||||
&& expectedVal.cause?.message == actualVal.error.cause?.message
|
||||
)
|
||||
is ResultValue.NotEvaluated -> Assert.assertEquals(
|
||||
"#$index: Expected $expectedVal, got NotEvaluated",
|
||||
|
||||
Reference in New Issue
Block a user