refs #22 test for try-free
This commit is contained in:
		
							parent
							
								
									aea819b89a
								
							
						
					
					
						commit
						bb862e6cb5
					
				@ -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())
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user