summaryrefslogtreecommitdiff
path: root/src/TestMode.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-08-25 18:09:40 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2026-08-25 18:35:52 +0200
commitb515ae37932b800b69df3ded320e4b673ee23cea (patch)
treec9b9bf005a3d7416528f0a797ffff2d7a7808cfb /src/TestMode.hs
parentec493e03b0415f43968c0a04598ada3272a0f0cf (diff)
Retport summary of test execution
Changelog: Added `--report` command-line option to print summary of passed/failed tests.
Diffstat (limited to 'src/TestMode.hs')
-rw-r--r--src/TestMode.hs18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/TestMode.hs b/src/TestMode.hs
index 90ced30..d865384 100644
--- a/src/TestMode.hs
+++ b/src/TestMode.hs
@@ -78,8 +78,8 @@ getNextTestNumber = do
modify $ \s -> s { tmsNextTestNumber = num + 1 }
return num
-runSingleTest :: Test -> CommandM Bool
-runSingleTest test = do
+runTestsC :: [ Test ] -> CommandM Report
+runTestsC tests = do
out <- asks tmiOutput
num <- getNextTestNumber
Just LoadedModules {..} <- gets tmsModules
@@ -88,11 +88,12 @@ runSingleTest test = do
{ optDefaultTool = fromMaybe "/bin/true" $ configTool =<< mbconfig
, optTestDir = ".test" <> show num
, optKeep = True
+ , optKeepGoing = True
, optHookTestResult = \tname res -> do
flip runReaderT out $ outLine OutputTestRaw Nothing $
"run-test-result " <> testNameBase tname <> " " <> (if res then "done" else "failed")
}
- liftIO (runTest out opts lmGlobalDefs test)
+ liftIO (runTests out opts lmGlobalDefs tests)
newtype CommandM a = CommandM (ReaderT TestModeInput (StateT TestModeState (ExceptT String IO)) a)
@@ -164,6 +165,11 @@ cmdRun = do
case filterTests (cfilter <> pfilter) lm of
Left err -> showError "run-failed" err
Right tests -> do
- forM_ tests $ \test -> do
- runSingleTest test
- cmdOut "run-done"
+ Report {..} <- runTestsC tests
+ cmdOut $ T.unwords
+ [ "run-done"
+ , T.pack (show reportTotalCount)
+ , T.pack (show reportPassedCount)
+ , T.pack (show reportSkippedCount)
+ , T.pack (show reportFailedCount)
+ ]