diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2016-01-26 12:36:21 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2016-01-26 12:37:29 +0000 |
commit | 3798b2aad8f62cb18e6147b54c57a9a4ad6c23f4 (patch) | |
tree | 829368730ae475c68a3d99c1af1b3baf18039aff | |
parent | f1885dfd7ee84fae478e2e8398d2eff14ee36b2c (diff) | |
download | haskell-3798b2aad8f62cb18e6147b54c57a9a4ad6c23f4.tar.gz |
Fix three broken tests involving exceptions
See comment:16 in Trac #10712. The tests were wrong, not GHC!
-rw-r--r-- | testsuite/tests/concurrent/should_run/T3279.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/concurrent/should_run/conc012.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/concurrent/should_run/conc014.hs | 12 |
3 files changed, 9 insertions, 11 deletions
diff --git a/testsuite/tests/concurrent/should_run/T3279.hs b/testsuite/tests/concurrent/should_run/T3279.hs index a90d38aaa4..b721a6113c 100644 --- a/testsuite/tests/concurrent/should_run/T3279.hs +++ b/testsuite/tests/concurrent/should_run/T3279.hs @@ -7,7 +7,7 @@ import GHC.IO (unsafeUnmask) f :: Int f = (1 +) . unsafePerformIO $ do - error "foo" `catch` \(SomeException e) -> do + throwIO (ErrorCall "foo") `catch` \(SomeException e) -> do myThreadId >>= flip throwTo e -- point X unsafeUnmask $ return 1 @@ -22,4 +22,4 @@ main = do yield -- should print 1 + 1 = 2 print f - + diff --git a/testsuite/tests/concurrent/should_run/conc012.hs b/testsuite/tests/concurrent/should_run/conc012.hs index a2f139e401..753fa894b6 100644 --- a/testsuite/tests/concurrent/should_run/conc012.hs +++ b/testsuite/tests/concurrent/should_run/conc012.hs @@ -14,8 +14,8 @@ stackoverflow n = n + stackoverflow n main = do let x = stackoverflow 1 - result <- newEmptyMVar - forkIO $ Control.Exception.catch (x `seq` putMVar result Finished) $ + result <- newEmptyMVar + forkIO $ Control.Exception.catch (evaluate x >> putMVar result Finished) $ \e -> putMVar result (Died e) res <- takeMVar result case res of diff --git a/testsuite/tests/concurrent/should_run/conc014.hs b/testsuite/tests/concurrent/should_run/conc014.hs index 76cb3c24b0..717167482d 100644 --- a/testsuite/tests/concurrent/should_run/conc014.hs +++ b/testsuite/tests/concurrent/should_run/conc014.hs @@ -8,14 +8,12 @@ main = do main_thread <- myThreadId m <- newEmptyMVar forkIO (do { takeMVar m; throwTo main_thread (ErrorCall "foo") }) - (do - error "wibble" - `Control.Exception.catch` + (do { throwIO (ErrorCall "wibble") + `Control.Exception.catch` (\e -> let _ = e::ErrorCall in - do putMVar m (); sum [1..10000] `seq` putStrLn "done.") - myDelay 500000 - ) - `Control.Exception.catch` + do putMVar m (); evaluate (sum [1..10000]); putStrLn "done.") + ; myDelay 500000 }) + `Control.Exception.catch` \e -> putStrLn ("caught: " ++ show (e::SomeException)) -- compensate for the fact that threadDelay is non-interruptible |