added exception reporting tests
This commit is contained in:
parent
0dbfb473bf
commit
1e18a162c4
@ -4375,4 +4375,42 @@ class ScriptTest {
|
|||||||
|
|
||||||
""".trimIndent())
|
""".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\"")
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -329,7 +329,7 @@
|
|||||||
<!-- Top-left version ribbon -->
|
<!-- Top-left version ribbon -->
|
||||||
<div class="corner-ribbon bg-danger text-white">
|
<div class="corner-ribbon bg-danger text-white">
|
||||||
<span style="margin-left: -5em">
|
<span style="margin-left: -5em">
|
||||||
v1.0.8-SNAPSHOT
|
v1.0.10-SNAPSHOT
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<!-- Fixed top navbar for the whole site -->
|
<!-- Fixed top navbar for the whole site -->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user