diff options
author | Kavon Farvardin <kavon@farvard.in> | 2018-09-23 15:29:37 -0500 |
---|---|---|
committer | Kavon Farvardin <kavon@farvard.in> | 2018-09-23 15:29:37 -0500 |
commit | 84c2ad99582391005b5e873198b15e9e9eb4f78d (patch) | |
tree | caa8c2f2ec7e97fbb4977263c6817c9af5025cf4 /testsuite/tests/codeGen/should_run/T5129.hs | |
parent | 8ddb47cfcf5776e9a3c55fd37947c8a95e00fa12 (diff) | |
parent | e68b439fe5de61b9a2ca51af472185c62ccb8b46 (diff) | |
download | haskell-wip/T13904.tar.gz |
update to current master againwip/T13904
Diffstat (limited to 'testsuite/tests/codeGen/should_run/T5129.hs')
-rw-r--r-- | testsuite/tests/codeGen/should_run/T5129.hs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/testsuite/tests/codeGen/should_run/T5129.hs b/testsuite/tests/codeGen/should_run/T5129.hs index 6bc1912754..2808f54eae 100644 --- a/testsuite/tests/codeGen/should_run/T5129.hs +++ b/testsuite/tests/codeGen/should_run/T5129.hs @@ -10,12 +10,13 @@ throwIfNegative n | n < 0 = error "negative" data HUnitFailure = HUnitFailure String deriving (Show,Typeable) instance Exception HUnitFailure +assertFailure :: String -> a -- Not an IO function! assertFailure msg = E.throw (HUnitFailure msg) -case_negative = - handleJust errorCalls (const $ return ()) $ do - evaluate $ throwIfNegative (-1) - assertFailure "must throw when given a negative number" +main :: IO () +main = + handleJust errorCalls (const (return ())) (do + evaluate (throwIfNegative (-1)) -- Pure expression evaluated in IO + assertFailure "must throw when given a negative number") where errorCalls (ErrorCall _) = Just () -main = case_negative |