From b515ae37932b800b69df3ded320e4b673ee23cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Tue, 25 Aug 2026 18:09:40 +0200 Subject: Retport summary of test execution Changelog: Added `--report` command-line option to print summary of passed/failed tests. --- src/TestMode.hs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/TestMode.hs') 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) + ] -- cgit v1.2.3