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/TestMode.hs | |
| parent | bbf1fd0846fa51f74ef01399ab005d4d847becce (diff) | |
Options to select and exclude tests in config file
Diffstat (limited to 'src/TestMode.hs')
| -rw-r--r-- | src/TestMode.hs | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/TestMode.hs b/src/TestMode.hs index 6a74b10..22d8237 100644 --- a/src/TestMode.hs +++ b/src/TestMode.hs @@ -25,7 +25,6 @@ import Output import Parser import Run import Script.Expr -import Script.Module import Test @@ -109,7 +108,6 @@ commands = [ ( "load", cmdLoad ) , ( "load-config", cmdLoadConfig ) , ( "run", cmdRun ) - , ( "run-all", cmdRunAll ) ] showError :: Text -> CustomTestError -> Command @@ -157,19 +155,13 @@ cmdRun :: Command cmdRun = do params <- asks tmiParams let ( select, exclude ) = fmap (map (T.drop 1)) $ partition (("^" /=) . T.take 1) params + pfilter = (TestFilter (if select == [ "*" ] then Nothing else Just select) exclude) + cfilter <- asks $ maybe mempty testFilterFromConfig . tmiConfig Just lm <- gets tmsModules - case filterTests (TestFilter (if select == [ "*" ] then Nothing else Just select) exclude) lm of + case filterTests (cfilter <> pfilter) lm of Left err -> showError "run-failed" err Right tests -> do forM_ tests $ \test -> do res <- runSingleTest test cmdOut $ "run-test-result " <> testName test <> " " <> (if res then "done" else "failed") cmdOut "run-done" - -cmdRunAll :: Command -cmdRunAll = do - Just LoadedModules {..} <- gets tmsModules - forM_ (concatMap moduleTests lmModules) $ \test -> do - res <- runSingleTest test - cmdOut $ "run-test-result " <> testName test <> " " <> (if res then "done" else "failed") - cmdOut "run-all-done" |