diff options
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 |