Commit cda3ec8d authored by Michal Terepeta's avatar Michal Terepeta
Browse files

Test: crash on errors

Previously Test would only print any errors (e.g., parsing errors).
Now it'll simply crash, making the failure obvious.
parent 9c07a4b7
...@@ -25,7 +25,7 @@ parseTest :: String -> IO () ...@@ -25,7 +25,7 @@ parseTest :: String -> IO ()
parseTest file = parseTest file =
do text <- readFile file do text <- readFile file
case parse file text of case parse file text of
Left err -> putStrLn err Left err -> error err
Right p -> mapM (putStrLn . showProc . snd) (runSimpleUniqueMonad $ runWithFuel 0 p) >> return () Right p -> mapM (putStrLn . showProc . snd) (runSimpleUniqueMonad $ runWithFuel 0 p) >> return ()
evalTest' :: String -> String -> ErrorM String evalTest' :: String -> String -> ErrorM String
...@@ -43,7 +43,7 @@ evalTest :: String -> IO () ...@@ -43,7 +43,7 @@ evalTest :: String -> IO ()
evalTest file = evalTest file =
do text <- readFile file do text <- readFile file
case evalTest' file text of case evalTest' file text of
Left err -> putStrLn err Left err -> error err
Right s -> putStrLn s Right s -> putStrLn s
optTest' :: M [Proc] -> ErrorM (M [Proc]) optTest' :: M [Proc] -> ErrorM (M [Proc])
...@@ -104,11 +104,11 @@ optTest file expectedFile = ...@@ -104,11 +104,11 @@ optTest file expectedFile =
do text <- readFile file do text <- readFile file
expectedText <- readFile expectedFile expectedText <- readFile expectedFile
case (parse file text, parse expectedFile expectedText) of case (parse file text, parse expectedFile expectedText) of
(Left err, _) -> putStrLn err (Left err, _) -> error err
(_, Left err) -> putStrLn err (_, Left err) -> error err
(Right lps, Right exps) -> (Right lps, Right exps) ->
case optTest' (liftM (snd . unzip) lps) of case optTest' (liftM (snd . unzip) lps) of
Left err -> putStrLn err Left err -> error err
Right p -> do { let opted = runSimpleUniqueMonad $ runWithFuel fuel p Right p -> do { let opted = runSimpleUniqueMonad $ runWithFuel fuel p
lbmaps = runSimpleUniqueMonad $ runWithFuel fuel (liftM (fst . unzip) lps) lbmaps = runSimpleUniqueMonad $ runWithFuel fuel (liftM (fst . unzip) lps)
expected = runSimpleUniqueMonad $ runWithFuel fuel exps expected = runSimpleUniqueMonad $ runWithFuel fuel exps
......
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