diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2025-06-21 22:27:44 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2025-06-21 22:27:44 +0200 |
commit | 179bf5d3ab9a925658c84e7a4ca393a96c10debb (patch) | |
tree | 332cc548ee68d3e5db84609ac2096eb7f4c43449 /src | |
parent | 511915adb65e6616e3ba3bae4cb61f6c708560c1 (diff) |
Changelog: Added `--exclude` command-line option to exclude tests
Diffstat (limited to 'src')
-rw-r--r-- | src/Main.hs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Main.hs b/src/Main.hs index 2f4a0fe..b3f7a2a 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -4,6 +4,7 @@ import Control.Monad import Data.List import Data.Maybe +import Data.Text (Text) import Data.Text qualified as T import Text.Read (readMaybe) @@ -30,6 +31,7 @@ import Version data CmdlineOptions = CmdlineOptions { optTest :: TestOptions , optRepeat :: Int + , optExclude :: [ Text ] , optVerbose :: Bool , optColor :: Maybe Bool , optShowHelp :: Bool @@ -41,6 +43,7 @@ defaultCmdlineOptions :: CmdlineOptions defaultCmdlineOptions = CmdlineOptions { optTest = defaultTestOptions , optRepeat = 1 + , optExclude = [] , optVerbose = False , optColor = Nothing , optShowHelp = False @@ -82,6 +85,9 @@ options = , Option ['r'] ["repeat"] (ReqArg (\str opts -> opts { optRepeat = read str }) "<count>") "number of times to repeat the test(s)" + , Option [ 'e' ] [ "exclude" ] + (ReqArg (\str opts -> opts { optExclude = T.pack str : optExclude opts }) "<test>") + "exclude given test from execution" , Option [] ["wait"] (NoArg $ to $ \opts -> opts { optWait = True }) "wait at the end of each test" @@ -174,7 +180,7 @@ main = do out <- startOutput outputStyle useColor ( modules, globalDefs ) <- loadModules (map fst files) - tests <- if null otests + tests <- filter ((`notElem` optExclude opts) . testName) <$> if null otests then fmap concat $ forM (zip modules files) $ \( Module {..}, ( filePath, mbTestName )) -> do case mbTestName of Nothing -> return moduleTests |