summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/codeGen/should_run/T5129.hs11
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