[commit: packages/hoopl] master: Test: crash on errors (cda3ec8)

git at git.haskell.org git at git.haskell.org
Mon Dec 21 22:13:32 UTC 2015


Repository : ssh://git@git.haskell.org/hoopl

On branch  : master
Link       : http://git.haskell.org/packages/hoopl.git/commitdiff/cda3ec8d331bbed7b2acfb30976f8930641a440b

>---------------------------------------------------------------

commit cda3ec8d331bbed7b2acfb30976f8930641a440b
Author: Michal Terepeta <michal.terepeta at gmail.com>
Date:   Sat Jun 27 16:29:59 2015 +0200

    Test: crash on errors
    
    Previously Test would only print any errors (e.g., parsing errors).
    Now it'll simply crash, making the failure obvious.


>---------------------------------------------------------------

cda3ec8d331bbed7b2acfb30976f8930641a440b
 testing/Test.hs | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/testing/Test.hs b/testing/Test.hs
index 7e8cb4a..85d15e7 100644
--- a/testing/Test.hs
+++ b/testing/Test.hs
@@ -25,7 +25,7 @@ parseTest :: String -> IO ()
 parseTest file =
   do text <- readFile file
      case parse file text of
-       Left err -> putStrLn err
+       Left err -> error err
        Right p  -> mapM (putStrLn . showProc . snd) (runSimpleUniqueMonad $ runWithFuel 0 p) >> return ()
 
 evalTest' :: String -> String -> ErrorM String
@@ -43,7 +43,7 @@ evalTest :: String -> IO ()
 evalTest file =
   do text    <- readFile file
      case evalTest' file text of
-       Left err -> putStrLn err
+       Left err -> error err
        Right  s -> putStrLn s
 
 optTest' :: M [Proc] -> ErrorM (M [Proc])
@@ -104,11 +104,11 @@ optTest file expectedFile =
   do text    <- readFile file
      expectedText <- readFile expectedFile
      case (parse file text, parse expectedFile expectedText) of
-       (Left err, _) -> putStrLn err
-       (_, Left err) -> putStrLn err
+       (Left err, _) -> error err
+       (_, Left err) -> error err
        (Right lps, Right exps) ->
          case optTest' (liftM (snd . unzip) lps) of
-           Left err -> putStrLn err
+           Left err -> error err
            Right p  -> do { let opted = runSimpleUniqueMonad $ runWithFuel fuel p
                                 lbmaps = runSimpleUniqueMonad $ runWithFuel fuel (liftM (fst . unzip) lps)
                                 expected = runSimpleUniqueMonad $ runWithFuel fuel exps



More information about the ghc-commits mailing list