added exception reporting tests

This commit is contained in:
Sergey Chernov 2025-12-22 12:59:11 +01:00
parent 0dbfb473bf
commit 1e18a162c4
2 changed files with 39 additions and 1 deletions

View File

@ -4375,4 +4375,42 @@ class ScriptTest {
""".trimIndent())
}
@Test
fun testProperlyReportExceptionPos() = runTest {
var x = assertFailsWith<ExecutionError> {
eval(
"""
val tmp = 11
if( tmp < 100 ) {
throw "success"
}
""".trimIndent()
)
}
println(x)
assertEquals(3, x.pos.line)
assertContains(x.message!!, "throw \"success\"")
// comments shoudl not change reporting:
x = assertFailsWith<ExecutionError> {
eval(
"""
val tmp = 11
/*
This should not change position:
*/
fun test() {
throw "success"
}
test()
""".trimIndent()
)
}
println(x)
assertEquals(5, x.pos.line)
assertContains(x.message!!, "throw \"success\"")
}
}

View File

@ -329,7 +329,7 @@
<!-- Top-left version ribbon -->
<div class="corner-ribbon bg-danger text-white">
<span style="margin-left: -5em">
v1.0.8-SNAPSHOT
v1.0.10-SNAPSHOT
</span>
</div>
<!-- Fixed top navbar for the whole site -->