diff options
author | Artem Pelenitsyn <a.pelenitsyn@gmail.com> | 2020-04-25 20:12:23 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-05-04 13:19:59 -0400 |
commit | 30272412fa437ab8e7a8035db94a278e10513413 (patch) | |
tree | ff6f602e294dca766b42f8177928894d0f1ca90b /testsuite/tests | |
parent | 0bf640b19d7a7ad0800152752a71c1dd4e6c696d (diff) | |
download | haskell-30272412fa437ab8e7a8035db94a278e10513413.tar.gz |
Remove custom ExceptionMonad class (#18075) (updating haddock submodule accordingly)
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/ghc-api/Makefile | 2 | ||||
-rw-r--r-- | testsuite/tests/ghc-api/T8628.hs | 3 | ||||
-rw-r--r-- | testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/ghc-api/downsweep/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/ghc-api/target-contents/TargetContents.hs | 3 | ||||
-rw-r--r-- | testsuite/tests/ghc-api/target-contents/all.T | 2 |
6 files changed, 11 insertions, 8 deletions
diff --git a/testsuite/tests/ghc-api/Makefile b/testsuite/tests/ghc-api/Makefile index 2470fbfaf2..557e27421f 100644 --- a/testsuite/tests/ghc-api/Makefile +++ b/testsuite/tests/ghc-api/Makefile @@ -17,7 +17,7 @@ T8639_api: T8628: rm -f T8628.o T8628.hi - '$(TEST_HC)' $(TEST_HC_OPTS) --make -v0 -package ghc T8628 + '$(TEST_HC)' $(TEST_HC_OPTS) --make -v0 -package ghc -package exceptions T8628 ./T8628 "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" T9015: diff --git a/testsuite/tests/ghc-api/T8628.hs b/testsuite/tests/ghc-api/T8628.hs index fa23bc5218..3874d6ed68 100644 --- a/testsuite/tests/ghc-api/T8628.hs +++ b/testsuite/tests/ghc-api/T8628.hs @@ -12,6 +12,7 @@ import GHC.Data.Bag (filterBag,isEmptyBag) import System.Directory (removeFile) import System.Environment( getArgs ) import GHC.Builtin.Names +import Control.Monad.Catch as MC main :: IO() main @@ -25,7 +26,7 @@ main , IIDecl (simpleImportDecl (mkModuleNameFS (fsLit "System.IO")))] runDecls "data X = Y ()" execStmt "print True" execOptions - gtry $ execStmt "print (Y ())" execOptions :: GhcMonad m => m (Either SomeException ExecResult) + MC.try $ execStmt "print (Y ())" execOptions :: GhcMonad m => m (Either SomeException ExecResult) runDecls "data X = Y () deriving Show" _ <- dynCompileExpr "'x'" execStmt "print (Y ())" execOptions diff --git a/testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs b/testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs index b0c6ce2761..7c782c9167 100644 --- a/testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs +++ b/testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs @@ -7,10 +7,11 @@ import GHC import GHC.Driver.Make import GHC.Driver.Session import GHC.Utils.Outputable -import GHC.Utils.Exception (ExceptionMonad, ghandle) +import GHC.Utils.Exception (ExceptionMonad) import GHC.Data.Bag import Control.Monad +import Control.Monad.Catch as MC (handle) import Control.Monad.IO.Class (liftIO) import Control.Exception import Data.IORef @@ -28,8 +29,8 @@ any_failed = unsafePerformIO $ newIORef False it :: ExceptionMonad m => [Char] -> m Bool -> m () it msg act = - ghandle (\(_ex :: AssertionFailed) -> dofail) $ - ghandle (\(_ex :: ExitCode) -> dofail) $ do + MC.handle (\(_ex :: AssertionFailed) -> dofail) $ + MC.handle (\(_ex :: ExitCode) -> dofail) $ do res <- act case res of False -> dofail diff --git a/testsuite/tests/ghc-api/downsweep/all.T b/testsuite/tests/ghc-api/downsweep/all.T index 2265997604..1096159c2c 100644 --- a/testsuite/tests/ghc-api/downsweep/all.T +++ b/testsuite/tests/ghc-api/downsweep/all.T @@ -3,7 +3,7 @@ test('PartialDownsweep', , ignore_stderr ], compile_and_run, - ['-package ghc']) + ['-package ghc -package exceptions']) test('OldModLocation', [ extra_run_opts('"' + config.libdir + '"') diff --git a/testsuite/tests/ghc-api/target-contents/TargetContents.hs b/testsuite/tests/ghc-api/target-contents/TargetContents.hs index a5ef99105f..f21b84ca87 100644 --- a/testsuite/tests/ghc-api/target-contents/TargetContents.hs +++ b/testsuite/tests/ghc-api/target-contents/TargetContents.hs @@ -6,6 +6,7 @@ import GHC.Driver.Session import GHC import Control.Monad +import Control.Monad.Catch as MC (try) import Control.Monad.IO.Class (liftIO) import Data.List (intercalate) import Data.Maybe @@ -105,7 +106,7 @@ go label targets mods = do liftIO $ hPutStrLn stderr $ "== " ++ label t <- liftIO getCurrentTime setTargets =<< catMaybes <$> mapM (mkTarget t) mods - ex <- gtry $ load LoadAllTargets + ex <- MC.try $ load LoadAllTargets case ex of Left ex -> liftIO $ hPutStrLn stderr $ show (ex :: SourceError) Right _ -> return () diff --git a/testsuite/tests/ghc-api/target-contents/all.T b/testsuite/tests/ghc-api/target-contents/all.T index 94cbfce9f0..fc6aa9230c 100644 --- a/testsuite/tests/ghc-api/target-contents/all.T +++ b/testsuite/tests/ghc-api/target-contents/all.T @@ -1,4 +1,4 @@ test('TargetContents', [extra_run_opts('"' + config.libdir + '"')] , compile_and_run, - ['-package ghc']) + ['-package ghc -package exceptions']) |