klyn.unittest.Assert.assertThrows
method
public static assertThrows<TYPE = Exception>(block as Object) as Void:
Description
Verifies that executing the lambda raises an exception. When `TYPE` is omitted, any exception type is accepted. When `TYPE` is provided, the raised exception must match it.
import klyn.unittest

Assert.assertThrows(lambda (): Int("abc"))
Assert.assertThrows<TypeError>(lambda (): Char(-1))
Parameters
  • block The lambda to execute. ``` import klyn.unittest Assert.assertThrows(lambda (): Int("abc")) Assert.assertThrows<TypeError>(lambda (): Char(-1)) ```