summaryrefslogtreecommitdiff
path: root/src/Run.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Run.hs')
-rw-r--r--src/Run.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Run.hs b/src/Run.hs
index e1bab46..f3805ea 100644
--- a/src/Run.hs
+++ b/src/Run.hs
@@ -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