Add some tests around nested orElse/catchSTM

Closes #208
This commit is contained in:
Michael Walker 2018-05-02 21:57:20 +01:00
parent 7cd308f9dd
commit 92e5b4881a

View File

@ -167,6 +167,18 @@ stmTests = toTestList
, djfu "MonadSTM is a MonadFail" (alwaysFailsWith isUncaughtException) , djfu "MonadSTM is a MonadFail" (alwaysFailsWith isUncaughtException)
(atomically $ fail "hello world" :: MonadConc m => m ()) -- avoid an ambiguous type (atomically $ fail "hello world" :: MonadConc m => m ()) -- avoid an ambiguous type
, djfu "'retry' is not caught by 'catch'" (gives' [True]) $
atomically
((retry `catchSomeException` \_ -> pure False) `orElse` pure True)
, djfu "'throw' is not caught by 'orElse'" (gives' [True]) $
atomically
((throwSTM Overflow `orElse` pure False) `catchSomeException` \_ -> pure True)
, djfu "'retry' in a nested 'orElse' only aborts the innermost" (gives' [True]) $
atomically
((retry `orElse` pure True) `orElse` pure False)
] ]
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------