✨ try-catch
This commit is contained in:
@ -65,6 +65,22 @@ pureTests =
|
||||
--
|
||||
testCase "Div0" $
|
||||
eval' (Div (CstInt 7) (CstInt 0))
|
||||
@?= ([], Left "Division by zero"),
|
||||
--
|
||||
testCase "TryCatch try1" $
|
||||
eval' (TryCatch (CstInt 1) (CstInt 2))
|
||||
@?= ([], Right (ValInt 1)),
|
||||
--
|
||||
testCase "TryCatch try2" $
|
||||
eval' (TryCatch (CstInt 1) (Div (CstInt 1) (CstInt 0)))
|
||||
@?= ([], Right (ValInt 1)),
|
||||
--
|
||||
testCase "TryCatch catch1" $
|
||||
eval' (TryCatch (Div (CstInt 1) (CstInt 0)) (CstInt 1))
|
||||
@?= ([], Right (ValInt 1)),
|
||||
--
|
||||
testCase "TryCatch catch1" $
|
||||
eval' (TryCatch (Div (CstInt 1) (CstInt 0)) (Div (CstInt 1) (CstInt 0)))
|
||||
@?= ([], Left "Division by zero")
|
||||
]
|
||||
|
||||
|
Reference in New Issue
Block a user