Commit 3a17eded authored by Simon Marlow's avatar Simon Marlow
Browse files

Add test for #5129

parent 44fcc0a9
{-# LANGUAGE DeriveDataTypeable #-}
import Control.Exception as E
import Data.Typeable
throwIfNegative :: Int -> String
throwIfNegative n | n < 0 = error "negative"
| otherwise = "no worries"
{-# NOINLINE throwIfNegative #-}
data HUnitFailure = HUnitFailure String deriving (Show,Typeable)
instance Exception HUnitFailure
assertFailure msg = E.throw (HUnitFailure msg)
case_negative =
handleJust errorCalls (const $ return ()) $ do
evaluate $ throwIfNegative (-1)
assertFailure "must throw when given a negative number"
where errorCalls (ErrorCall _) = Just ()
main = case_negative
......@@ -86,3 +86,4 @@ test('3677', extra_run_opts('+RTS -K8k -RTS'), compile_and_run, [''])
test('4441', normal, compile_and_run, [''])
test('5149', omit_ways(['ghci']), multisrc_compile_and_run,
['5149', ['5149_cmm.cmm'], ''])
test('5129', normal, compile_and_run, [''])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment