diff options
| author | Roman Smrž <roman.smrz@seznam.cz> | 2026-05-27 20:40:06 +0200 |
|---|---|---|
| committer | Roman Smrž <roman.smrz@seznam.cz> | 2026-05-31 13:48:13 +0200 |
| commit | a7c646b2d61b1e23eb44b608b843f2673acaa5bd (patch) | |
| tree | 8a5294947a1eb78b29ca03d48ba62fec07c2ecad /src/Run.hs | |
| parent | bbf1fd0846fa51f74ef01399ab005d4d847becce (diff) | |
Options to select and exclude tests in config file
Diffstat (limited to 'src/Run.hs')
| -rw-r--r-- | src/Run.hs | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -7,6 +7,7 @@ module Run ( evalGlobalDefs, TestFilter(..), + testFilterFromConfig, filterTests, ) where @@ -37,6 +38,7 @@ import System.Posix.Process import System.Posix.Signals import System.Process +import Config import GDB import Network import Network.Ip @@ -185,6 +187,20 @@ data TestFilter = TestFilter , tfExclude :: [ Text ] } +instance Semigroup TestFilter where + a <> b + | isJust (tfSelect b) = b + | otherwise = a { tfExclude = tfExclude a <> tfExclude b } + +instance Monoid TestFilter where + mempty = TestFilter Nothing [] + +testFilterFromConfig :: Config -> TestFilter +testFilterFromConfig Config {..} = TestFilter + { tfSelect = configSelect + , tfExclude = configExclude + } + filterTests :: TestFilter -> LoadedModules -> Either CustomTestError [ Test ] filterTests TestFilter {..} LoadedModules {..} = do let allTests = concatMap (\m -> ( moduleName m, ) <$> moduleTests m) lmModules |