NorfairKing / sydtest

A modern testing framework for Haskell with good defaults and advanced testing features.
115 stars 25 forks source link

Add `sydTest'` that returns the test tree #41

Closed srid closed 1 year ago

srid commented 2 years ago

Basically, this function is useful to implement post-processing tasks like https://github.com/Plutonomicon/plutarch/issues/389

-- | Like `sydTest` but returns the test tree.
sydTest' :: MonadIO m => Spec -> m [SpecTree ()]
sydTest' spec = do
  config <- liftIO $ getSettings
  resultForest <- liftIO $ timedValue <$> sydTestResult config spec
  if shouldExitFail config resultForest
    then liftIO $ exitWith (ExitFailure 1)
    else pure $ void <$> resultForest

Alternatively, I propose making sydTestWith return the tree if backwards compact is unimportant.

NorfairKing commented 2 years ago

I'd like to see how this is used before we consider adding it to sydtest.

srid commented 2 years ago

https://github.com/Plutonomicon/plutarch/pull/390

NorfairKing commented 2 years ago

This is the first time that it comes in handy that sydtest is also a library. Let's see if anyone else would have needed this.

NorfairKing commented 1 year ago

Closing until anyone else needs this.