From 4aa42163547a331652b0ea65889c57a2bb2e11f1 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Sun, 11 Jan 2026 23:52:19 +0000 Subject: [PATCH] Show cumulative times for tests with dependents --- haskell/Pre.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/haskell/Pre.hs b/haskell/Pre.hs index fc4bdc9..84ab04f 100644 --- a/haskell/Pre.hs +++ b/haskell/Pre.hs @@ -107,6 +107,7 @@ import Control.Monad.Writer import Data.Bifunctor import Data.Bool import Data.Char +import Data.Either.Extra import Data.Finite import Data.Fixed (Fixed (MkFixed)) import Data.Foldable hiding (foldl1, foldr1, maximum, maximumBy, minimum, minimumBy) @@ -433,8 +434,10 @@ runTests opts r0 (TestTree name tc ts) = pure $ Left e Right (Left e) -> pure $ Left $ ExceptionFailure e - Right (Right (r, dt)) -> - Right . (dt,) <$> for ts (runTests opts r) + Right (Right (r, dt)) -> do + rs <- for ts $ runTests opts r + let childTimes = fromMaybe 0 $ eitherToMaybe $ fmap (sum . map fst) $ traverse (.result) rs + pure $ Right (dt + childTimes, rs) where runTest = \case TestCase f -> timed (liftIO . evaluate . DeepSeq.force) $ f r0