diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2025-04-27 10:30:41 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2025-05-09 21:16:50 +0200 |
commit | 31608670fe91a11b5a51b7a0b627ba4ade56eaa1 (patch) | |
tree | 74b2ed5cc26ccb2cf3435a0546ea381875e857ca /src/Main.hs | |
parent | 09fbd3b2cb359afcf0bfe5652f98be09b4835546 (diff) |
Return error from parseTestFile
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/Main.hs b/src/Main.hs index 64741e4..abc96ac 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -8,6 +8,7 @@ import Data.Maybe import Data.Text qualified as T import Text.Read (readMaybe) +import Text.Megaparsec (errorBundlePretty, showErrorComponent) import System.Console.GetOpt import System.Directory @@ -170,7 +171,17 @@ main = do | otherwise = OutputStyleQuiet out <- startOutput outputStyle useColor - ( modules, allModules ) <- parseTestFiles $ map fst files + ( modules, allModules ) <- parseTestFiles (map fst files) >>= \case + Right res -> do + return res + Left err -> do + case err of + ImportModuleError bundle -> + putStr (errorBundlePretty bundle) + _ -> do + putStrLn (showErrorComponent err) + exitFailure + tests <- forM (zip modules files) $ \( Module {..}, ( filePath, mbTestName )) -> do case mbTestName of Nothing -> return moduleTests |