Ensure.k 254 B

1234567891011121314
  1. invoke {
  2. function test () -> String {
  3. ensure ok { 1+1 == 3 }
  4. return 'impossible'
  5. ...
  6. handle error {
  7. unless ok {
  8. return 'caught'
  9. }
  10. }
  11. }
  12. assert test() == 'caught'
  13. }