refs #22 test for try-free

This commit is contained in:
Sergey Chernov 2025-06-13 01:52:44 +04:00
parent aea819b89a
commit bb862e6cb5

View File

@ -1833,4 +1833,25 @@ class ScriptTest {
""".trimIndent())
}
@Test
fun testTryFinally() = runTest {
val c = Context()
assertFails {
c.eval(
"""
var resource = "used"
try {
throw "test"
}
finally {
resource = "freed"
}
""".trimIndent()
)
}
c.eval("""
assertEquals("freed", resource)
""".trimIndent())
}
}