🕸️ Try-Catch

This commit is contained in:
2024-09-06 14:14:44 +02:00
parent b4f8b71ade
commit e96686ab9a
3 changed files with 12 additions and 3 deletions

View File

@ -102,5 +102,11 @@ tests =
eval [] (Apply (Let "x" (CstInt 2) (Lambda "y" (Add (Var "x") (Var "y")))) (CstInt 3))
@?= Right (ValInt 5),
testCase "Apply (fact)" $
eval envEmpty (Apply fact (CstInt 5)) @?= Right (ValInt 120)
eval envEmpty (Apply fact (CstInt 5)) @?= Right (ValInt 120),
testCase "Try" $
eval envEmpty (TryCatch (CstInt 0) (CstInt 1))
@?= Right (ValInt 0),
testCase "Catch" $
eval envEmpty (TryCatch (Var "missing") (CstInt 1))
@?= Right (ValInt 1)
]