diff options
| author | Roman Smrž <roman.smrz@seznam.cz> | 2026-05-23 11:41:38 +0200 |
|---|---|---|
| committer | Roman Smrž <roman.smrz@seznam.cz> | 2026-05-23 11:41:38 +0200 |
| commit | b3bf16872222058395c6224e862c1e12f7d829dc (patch) | |
| tree | c580ac39afa88a6c08244acede8df5e033dc6d6f /src | |
| parent | f57ff5611c28e42df9e419da3c9af166cd4c3570 (diff) | |
Accept tags as exclude parameters
Diffstat (limited to 'src')
| -rw-r--r-- | src/Main.hs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Main.hs b/src/Main.hs index 619c4a5..a77e8cc 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -23,6 +23,7 @@ import Output import Process import Run import Script.Module +import Script.Var import Test import TestMode import Util @@ -94,8 +95,8 @@ options = (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" + (ReqArg (\str opts -> opts { optExclude = T.pack str : optExclude opts }) "<test|tag>") + "exclude given test or test tag from execution" , Option [] ["wait"] (NoArg $ to $ \opts -> opts { optWait = True }) "wait at the end of each test" @@ -193,8 +194,10 @@ main = do | otherwise = OutputStyleQuiet out <- startOutput outputStyle useColor - ( modules, _, globalDefs ) <- loadModules (map fst files) - tests <- filter ((`notElem` optExclude opts) . testName) <$> if null otests + ( modules, tags, globalDefs ) <- loadModules (map fst files) + + let excludedTests = optExclude opts ++ map (snd . fst) (filter (\( ( _, _ ), ts ) -> any (\(Tag _ t) -> textVarName t `elem` optExclude opts) ts) tags) + tests <- filter ((`notElem` excludedTests) . testName) <$> if null otests then fmap concat $ forM (zip modules files) $ \( Module {..}, ( filePath, mbTestName )) -> do case mbTestName of Nothing -> return moduleTests |