Skip to content

Commit

Permalink
Add exception tests
Browse files Browse the repository at this point in the history
  • Loading branch information
turion committed Mar 29, 2024
1 parent 4dffffe commit 9f54177
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions rhine/test/Except.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,18 @@ tests =
go $ n - 1
inputs = [0]
runScheduleRhinePure (clsf @@ FixedStep @1) inputs @?= [Just 0]
, testCase "Can raise, catch, and keep very many exceptions without steps in between" $ do
let clsf = safely $ go 1000 []
go n ns = do
_ <- try $ throwOnCond (< n) () >>> arr (const ns)
go (n - 1) (n : ns)
inputs = [0]
runScheduleRhinePure (clsf @@ FixedStep @1) inputs @?= [Just [1 .. 1000]]
, testCase "Can raise, catch, and keep very many exceptions without steps in between, using Monad" $ do
let clsf = safely $ go 1000 []
go n ns = do
n' <- try $ throwOnCond (< n) n >>> arr (const ns)
go (n' - 1) (n' : ns)
inputs = [0]
runScheduleRhinePure (clsf @@ FixedStep @1) inputs @?= [Just [1 .. 1000]]
]

0 comments on commit 9f54177

Please sign in to comment.