diff --git a/libraries/scripting/jvm-host-test/test/kotlin/script/experimental/jvmhost/test/ConstructorArgumentOrderTest.kt b/libraries/scripting/jvm-host-test/test/kotlin/script/experimental/jvmhost/test/ConstructorArgumentOrderTest.kt index 5ea135d1eca..a86b9817971 100644 --- a/libraries/scripting/jvm-host-test/test/kotlin/script/experimental/jvmhost/test/ConstructorArgumentOrderTest.kt +++ b/libraries/scripting/jvm-host-test/test/kotlin/script/experimental/jvmhost/test/ConstructorArgumentOrderTest.kt @@ -6,6 +6,7 @@ package kotlin.script.experimental.jvmhost.test import org.junit.Test +import kotlin.script.experimental.api.EvaluationResult import kotlin.script.experimental.api.ResultWithDiagnostics import kotlin.script.experimental.api.implicitReceivers import kotlin.script.experimental.api.providedProperties @@ -21,7 +22,7 @@ class ConstructorArgumentsOrderTest { assertTrue( res is ResultWithDiagnostics.Success, - "test failed:\n ${res.reports.joinToString("\n ") { it.message + if (it.exception == null) "" else ": ${it.exception}" }}" + "test failed:\n ${res.render()}" ) } @@ -33,7 +34,7 @@ class ConstructorArgumentsOrderTest { assertTrue( res is ResultWithDiagnostics.Success, - "test failed:\n ${res.reports.joinToString("\n ") { it.message + if (it.exception == null) "" else ": ${it.exception}" }}" + "test failed:\n ${res.render()}" ) } @@ -46,7 +47,10 @@ class ConstructorArgumentsOrderTest { assertTrue( res is ResultWithDiagnostics.Success, - "test failed:\n ${res.reports.joinToString("\n ") { it.message + if (it.exception == null) "" else ": ${it.exception}" }}" + "test failed:\n ${res.render()}" ) } + + private fun ResultWithDiagnostics.render() = + reports.joinToString("\n ") { it.message + if (it.exception == null) "" else ": ${it.exception!!.printStackTrace()}" } } diff --git a/libraries/scripting/jvm-host-test/test/kotlin/script/experimental/jvmhost/test/ScriptingHostTest.kt b/libraries/scripting/jvm-host-test/test/kotlin/script/experimental/jvmhost/test/ScriptingHostTest.kt index 31478ff2e37..ea125bec3c7 100644 --- a/libraries/scripting/jvm-host-test/test/kotlin/script/experimental/jvmhost/test/ScriptingHostTest.kt +++ b/libraries/scripting/jvm-host-test/test/kotlin/script/experimental/jvmhost/test/ScriptingHostTest.kt @@ -66,7 +66,8 @@ class ScriptingHostTest : TestCase() { @Test fun testValueResult() { - val resVal = evalScriptWithResult("42") as ResultValue.Value + val evalScriptWithResult = evalScriptWithResult("42") + val resVal = evalScriptWithResult as ResultValue.Value Assert.assertEquals(42, resVal.value) Assert.assertEquals("\$\$result", resVal.name) Assert.assertEquals("kotlin.Int", resVal.type)